Re: Error in Dynamic SQL

From: Michael Ryan <ryan_at_xsoft.xerox.com>
Date: 1995/05/22
Message-ID: <1995May22.214712.16603_at_xsoft.uucp>#1/1


In article <3piqjt$l2u_at_karuna.tcs.com>, qing_at_karuna.tcs.com (Cathy Lin) writes:
>I have a question for Pro*C users:
>
>I'm using Dynamic SQL to execute some very straightfoward 'FETCH',
>'INSERT INTO' and 'DELETE' statements(no PL/SQL stuff) and I got
>an error:
>ORA-01001: invalid cursor
>
>The place it points to DOES NOT use cursors, just PREPARE and
>EXECUTE.
wanted to point out that the program IS using cursors, they are just implicit. see p2-7 of the "Programmer's Guide to the ORACLE Precompilers."

POINT: are you checking for error conditions after the PREPARE? are you using

        EXEC SQL WHENEVER SQLERROR GOTO
to catch your error? how do you get this error message?

you may want to check the SQLCA after the prepare to make sure it's ok. from Xerox code created from ORACLE examples:
  /* prepare select_id for the select command */

  db_selectcmd = seldata.sqlCommand;

  EXEC SQL PREPARE SELECT_ID FROM :db_selectcmd;

  if (sqlca.sqlcode != 0)
  {

     /* do the error handling thing... */
     return;

  }  

good luck
//michael

-- 
:: michael ryan , ryan_at_xsoft.xerox.com
:: ob disclaimer: opinions expressed are not those of xerox, corp.
Received on Mon May 22 1995 - 00:00:00 CEST

Original text of this message