is there a way to call a stored procedure from a dynamic SQL statement? I don't know the name of the stored procedure at compile time, so I have to build the SQL command invoking the SP dynamically.
Thank you in advance,
I dont think that can be done,also in other databases that I know too. sTored procs are called or
compiled , example below
CALL abc (1, amt);
.compile file def.spl
Maybe you can break up into conditional logics.
Let us hear from others too, if I miss out on this functionality.
check the SQL Stored Procedures and Embedded SQL manual.
There's a section named SQL Statements that Cannot Be Used Dynamically and CALL is one of them.
Hi Raja, hi Dieter,
thank you very much for your answers. I pretty much expected your answers, but I just wanted to be sure if there's another way of invoking SPs that I was not aware of.
Fortunatelly, I don't really need to invoke SPs dynamically - basically there's a finite set of SPs that will possibly be called. I don't know this set by now, but at some point in the future. So I am going to do what Raja suggested - break it up into conditional logic and invoke the SPs in a static way. That should do the trick.
Thanks for your help,