ODBC: SQLExecute fails when I add Oracle function SUM
Date: 30 May 2003 16:09:07 -0700
Message-ID: <c452700a.0305301509.467278e3_at_posting.google.com>
The code below worked perfectly when I didn't have the SUM function in the select statement, but when I add it fails at SQLExecute call with:
Fri May 30 16:23:37 2003 - S1000:1:921:[Oracle][ODBC][Ora]ORA-00921: unexpected end of SQL command
Here's the code:
sprintf(selectstatement,
"select SUM(amount), date from pago where account_no = 10 and status =
0 group by payment_due_date");
// Prepare the SQL statement by assigning it to the statement handle retval = SQLPrepare(hstmt, (SQLCHAR*) selectstatement, sizeof(selectstatement));
if ((retval != SQL_SUCCESS) && (retval != SQL_SUCCESS_WITH_INFO))
{
// Prepare failed, call SQLGetDiagRec for errors. }
// Execute the SQL statement handle
retval = SQLExecute(hstmt);
if ((retval != SQL_SUCCESS) && (retval != SQL_SUCCESS_WITH_INFO))
{
// Execute failed, call SQLGetDiagRec for errors. }
Any idea what is wrong? Thanks.
chris Received on Sat May 31 2003 - 01:09:07 CEST