with ADOQ_JCDDBH do
begin
close;
sql.Clear;
sql.Add('select MAX(substrb(RWH,4,12)) from jh_jsjh where substrb(RWH,4,10)=:rwhbf and SFXZWC=1 and SFBJWC=0 ');
Parameters.ParamByName('rwhbf').Value:=QuotedStr(ADOQ_XTYM.FieldByName('xtny').AsString+ADOQ_SFBJWC.FieldByName('DDBH').AsString);
Prepared;
Open;
end;
仍然出现“ORA-00937:非单组分组函数”
begin
close;
sql.Clear;
sql.Add('select MAX(substrb(RWH,4,12)) from jh_jsjh where substrb(RWH,4,10)=:rwhbf and SFXZWC=1 and SFBJWC=0 ');
Parameters.ParamByName('rwhbf').Value:=QuotedStr(ADOQ_XTYM.FieldByName('xtny').AsString+ADOQ_SFBJWC.FieldByName('DDBH').AsString);
Prepared;
Open;
end;
仍然出现“ORA-00937:非单组分组函数”
with ADOQ_JCDDBH do
begin
Prepared;
close;
sql.Clear;
sql.Add('select MAX(substrb(RWH,4,12)) from jh_jsjh where substrb(RWH,4,10)='+
QuotedStr(ADOQ_XTYM.FieldByName('xtny').AsString+ADOQ_SFBJWC.FieldByName('DDBH').AsString)+' and SFXZWC=1 and SFBJWC=0 ');
Open;
end; 看看能不能执行,或者你定义一个变量
vSQL:='select MAX(substrb(RWH,4,12)) from jh_jsjh where substrb(RWH,4,10)='+
QuotedStr(ADOQ_XTYM.FieldByName('xtny').AsString+ADOQ_SFBJWC.FieldByName('DDBH').AsString)+' and SFXZWC=1 and SFBJWC=0 ';sql.Text := vSQL;跟踪一下,看看生成的SQL是否正确?
不建议使用Add方法,难于调试!