Re: dynamically called a stored procedure from proC?

From: Michael Krolewski <vandra_at_u.washington.edu>
Date: 1998/03/19
Message-ID: <35121A31.69B97522_at_u.washington.edu>#1/1


Yes you can.....

Basically, you want to make a sql statement like...

char mySql[] = "begin\n"

                        " -- some comment included a example \n "
                        " myProcedure(var1, var2);\n "
                        " end; ";

Note The ending semicolon is needed (at least under OCI -- and under ProC)
I am not sure why the returns are needed but they seemed to make things go. Recall
Oracle is a white space insensative language. However, the returns are needed to
separate lines especially with comments.

You should be able to bind to these blocks using the usual means.

Mike Krolewski

Jack Tolson wrote:

> Is there a way to dynamically called a stored procedure from
> proC? I know that you can call a dynamic sql statement.
> You can get a desciptor and build the statement. However,
> it seems that you have to create a sql block. Meaning that
> you have to define a block, something like this example:
>
> exec sql;
> begin
> stored procedure;
> end;
>
> This works but the stored procedure must be hardcoded
> between the block. I precompiled the code and it seems
> that the code that is generated is a string that is pass
> to another oracle function. I there a way that I can create
> this string on the fly. I could write something to modify
> the generated code but this seems to me to be a maintenance
> nightmare. So, is there a way to do this through proC.
>
> I also tried:
> exe = "execute stored proc";
> EXEC SQL :exe;
> The precompiler did not like this statement;
>
> P.S. Also, can I call a function that returns a value.
Received on Thu Mar 19 1998 - 00:00:00 CET

Original text of this message