MySQL Forums
Forum List  »  Informix

Using dynamic SQL in Informix's stored procedure..
Posted by: Puneet
Date: August 09, 2004 05:26AM

hi,
i want to create a procedure in informix in which table name is in a variable (strTable) and i want to retrieve the records from that table.
Later i will link this procedure to crystal report to create a report of the records.
eg. Define strTable Varchar(30);
Let strTable = "Employee";
Select * from strTable;
I tried dynamic sql statements "prepare" and "execute" in the procedure but it didn't work.
eg.
CREATE PROCEDURE tempProc() RETURNING VarChar(30);
DEFINE tmpstr VARCHAR(255);
Let tmpstr='Employee';
foreach curTemp For
prepare s1 from "Select Region_name from ?";
execute s1 using tmpstr WITH RESUME;
END FOREACH
END PROCEDURE;
pls help me if u know any solution to this problem.
Regards,
Puneet
(puneetjaggi@indiatimes.com)

Options: ReplyQuote


Subject
Views
Written By
Posted
Using dynamic SQL in Informix's stored procedure..
18557
August 09, 2004 05:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.