Re: ODBC: SQLExecute fails when I add Oracle function SUM

From: chris <od488gw02_at_sneakemail.com>
Date: 2 Jun 2003 09:41:01 -0700
Message-ID: <c452700a.0306020841.6274f040_at_posting.google.com>


od488gw02_at_sneakemail.com (chris) wrote in message news:<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

forgot to add that not only did I add SUM function, but also ORDER BY statement. So one of these broke it.

chris Received on Mon Jun 02 2003 - 18:41:01 CEST

Original text of this message