Re: Informix Prepared Statements
Posted in 2007
Topics: Stored Procedures & SPL
lisa_0801@yahoo.com said:
> I'm trying to create the below sp in informix but i'm getting a syntax
> error which points to the prepare statement. Please help!
>
> CREATE PROCEDURE test()>
> DEFINE sSQL CHAR (100);
>
> LET sSQL = "select * from test";
>
> PREPARE STATEMENT1 FROM sSQL
>
> END PROCEDURE;
You can't do dynamic SQL in procedures. If you have a version 9 or
greater, you can download the EXEC bladelet, otherwise you're buggered.
--
Bye now,
Obnoxio
"I'm astonished anyone pays real money for this crap."
-- Cosmo
--
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.
Obnoxio The Clown wrote:
> lisa_0801@yahoo.com said:
>> I'm trying to create the below sp in informix but i'm getting a syntax
>> error which points to the prepare statement. Please help!
>>
>> CREATE PROCEDURE test()>>
>> DEFINE sSQL CHAR (100);
>>
>> LET sSQL = "select * from test";
>>
>> PREPARE STATEMENT1 FROM sSQL
>>
>> END PROCEDURE;
>
> You can't do dynamic SQL in procedures. If you have a version 9 or
> greater, you can download the EXEC bladelet, otherwise you're buggered.
>
Also note that as soon as you create the procedure the query plans are calculated...
If you're preparing the statement for performance reasons there is no need...
--
Fernando Nunes
Portugal
http://informix-technology.blogspot.com
My email works... but I don't check it frequently...