Home > Back-end >  Delphi use ADO to execute SQL times wrong: ORA - 00937: not a single - group, group function
Delphi use ADO to execute SQL times wrong: ORA - 00937: not a single - group, group function

Time:09-26

Delphi using ADO database programming, execute SQL complains, below is the detail
There are three ways splicing SQL
* *, * * way 1 complains ORA - 00937: not a single - group, group function
Adoquery. Close;
Adoquery. SQL. Text:='select count (*) icount the from testtable where testno=: no and testname=: name';
Adoquery. The Parameters. ParamByName (' no '). The Value:=Number;
Adoquery. The Parameters. ParamByName (' name '). The Value:=name;
Adoquery. Open;
Adoquery. First;
Result:=adoquery FieldByName (' icount). AsInteger;
Way 2 can do * * * *
Adoquery. Close;
Adoquery. SQL. Text:=Format (' select count (*) icount the from testtable where testno=', '% s'' and testname=', '% s'' ', [Number, the Name]);
Adoquery. Open;
Adoquery. First;
Result:=adoquery FieldByName (' icount). AsInteger;
Pattern 3 can perform * * * *
Adoquery. Close;
Adoquery. SQL. Text:='select * from (select count (*) from testtable where testno=: no and testname=: name)';
Adoquery. The Parameters. ParamByName (' no '). The Value:=Number;
Adoquery. The Parameters. ParamByName (' name '). The Value:=name;
Adoquery. Open;
Adoquery. First;
Result:=adoquery Fields. [0] AsVariant
Add:
SQL way to the first error is in MSDAORA. 1 driven by an error, but using OraOLEDB. Oracle. 1 driver can
What is the reason why

CodePudding user response:

Used to link the oracle can be accessed through two interfaces: "MSDAORA" and "OraOLEDB. Oracle
"
1, "MSDAORA" access interface is by Microsoft OLE DB Provider for Oracle, provided by the access interface to establish the link server in the query Oracle table (with CLOB data types, BLOB field) when an error,

2, "OraOLEDB. Oracle" access interface is provided by Oracle for Oracle Probider OLE DB driver, it solves two inconsistent database type questions, and if you need to use a distributed transaction, you must use it to create a link to the server,

Both in use, some grammar is different, it is recommended to use oracle vendor's original drive,

CodePudding user response:

Only clear, pay attention to the SQL and Oracle database of different SQL syntax,

CodePudding user response:

Upstairs is supposed to be positive solution,
  • Related