Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Need help w/Pro*C dynamic SQL based stored proc w/cursor output arg

Need help w/Pro*C dynamic SQL based stored proc w/cursor output arg

From: <alexsokol_at_my-dejanews.com>
Date: Tue, 12 Jan 1999 17:57:32 GMT
Message-ID: <77g2ed$hg$1@nnrp2.dejanews.com>


I have Pro*C code that works to execute a stored procedure that takes integer as IN arg, and places an SQL_CURSOR into a 2nd OUT argument. Its as simple as doing:

      SQL_CURSOR cursArg_out;
      .....
      EXEC SQL ALLOCATE :cursArg_out;
      EXEC SQL EXECUTE my_proc (:integerArg_in, :cursArg_out);

Now, I am trying to move from above to dynamic SQL to be able to avoid pro*c semantics check as well as to be able to supply stored procedure name run time. Here is the code that works with other types of IN/OUT vars but not with the SQL_CURSOR type:

      char sqlbuf[1024];
      char *sproc="Foo";
      sprintf (sqlbuf, "%s (:in_arg, :out_arg)");

  EXEC SQL PREPARE S FROM :sqlbuf;  EXEC SQL EXECUTE S USING :integerArg_in,
:xxx_out;  ^^^^^^^^^^^ As I said above works with other argument tyeps but
with cursor 2nd argument, I get:

>>>>

Pro*C/C++: Release 2.2.4.0.0 - Production on Tue Jan 12 12:53:33 1999

    EXEC SQL EXECUTE S USING :integerArg_in, :cursorArg_out;

...............................................1
(1) PCC-S-02319, expression type does not match usage
>>>>

What is the right (only?) way to use dynamic SQL on a stored procedure that takes a cursor?

Thanks,
Alex.

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Jan 12 1999 - 11:57:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US