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)
Subject
Views
Written By
Posted
Using dynamic SQL in Informix's stored procedure..
18909
August 09, 2004 05:26AM
8814
August 09, 2004 06:10AM
14018
August 11, 2004 03:31AM
8396
November 16, 2004 02:21PM
8027
August 12, 2005 12:00AM
8155
November 21, 2004 05:35AM
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.