delphi6+oracle7.3.4(客户端):
ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add('where nxx_nbr = :nxx_nbr');
ADOQuery.SQL.Add('and line_nbr = :line_Nbr');
ADOQuery.Parameters.ParamByName('nxx_nbr').Value := sNxxNbr;
ADOQuery.Parameters.ParamByName('line_Nbr').Value := sLineNbr;
ADOQuery.Open;
以上代码出错,提示ORA-00937 not a single-group group function。
如果改为
ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add('where nxx_nbr = ''8888'' ');
ADOQuery.SQL.Add('and line_nbr = ''0000'' ');
则不会出错。
请问如何解决?
ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add('where nxx_nbr = :nxx_nbr');
ADOQuery.SQL.Add('and line_nbr = :line_Nbr');
ADOQuery.Parameters.ParamByName('nxx_nbr').Value := sNxxNbr;
ADOQuery.Parameters.ParamByName('line_Nbr').Value := sLineNbr;
ADOQuery.Open;
以上代码出错,提示ORA-00937 not a single-group group function。
如果改为
ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add('where nxx_nbr = ''8888'' ');
ADOQuery.SQL.Add('and line_nbr = ''0000'' ');
则不会出错。
请问如何解决?
后面加上一个空格试试
ADOQuery.SQL.Add('where nxx_nbr = :nxx_nbr ');
>> ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
>> ADOQuery.SQL.Add('where nxx_nbr = :nxx_nbr');
>> ADOQuery.SQL.Add('and line_nbr = :line_Nbr');SQL.Add只是把后面的参数简单地加进去。
那些空格你要自己加上去的。 ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add(' where nxx_nbr = :nxx_nbr');
ADOQuery.SQL.Add(' and line_nbr = :line_Nbr');oracle没用过,SQL语句多加一个空格应该没有问题吧?
>> ADOQuery.SQL.Add('and line_nbr = ''0000'' ');上面那个能执行成功可能是: ADOQuery.SQL.Add('where nxx_nbr = ''8888'' ');
^^-------这里有空格
ADOQuery.SQL.Add('and line_nbr = ''0000'' ');
var
parame:Tparameter;
begin
ADOQuery.SQL.Add('select count(*) from acc_nbr_handle ');
ADOQuery.SQL.Add('where nxx_nbr = :nxx_nbr');
ADOQuery.SQL.Add('and line_nbr = :line_Nbr');
parame=ADOQuery1.Parameters.AddParameter;
parame.Name:='nxx_nbr';
parame=ADOQuery1.Parameters.AddParameter;
parame.Name:='line_Nbr';
ADOQuery.Parameters.ParamByName('nxx_nbr').Value := sNxxNbr;
ADOQuery.Parameters.ParamByName('line_Nbr').Value := sLineNbr;
ADOQuery.Open;end;
WbtServer() 的方法我试试。
Parameter 对象被不正确地定义。提供了不一致或不完整的信息。