Hi,
I have a problem concerning PL/SQL, and I want to describe it on a concrete example:
Let's suppose that you have a table called "Sqlstatement_Table". Here's the code for that table:
CREATE TABLE Sqlstatement_Table(
Statement VARCHAR2(200));
Let there be only one entry in the table: the string 'Select * FROM X_Table'.
OK, and now, I want to execute this statement. Therefore, I write the following code:
DECLARE
h_var VARCHAR2(200);
BEGIN
select Statement into h_var from Sqlstatement_Table;
??? EXECUTE IMMEDIATE h_var; ???
END;
/
The variable h_var contains now the string 'Select * FROM X_Table'. It doesn't work like this; the line between ??? is not correct. But how can I transform this string in an executable SQL statement? How can I make ORACLE execute this code?
-Thanks for your help!
Jeronimo
I have a problem concerning PL/SQL, and I want to describe it on a concrete example:
Let's suppose that you have a table called "Sqlstatement_Table". Here's the code for that table:
CREATE TABLE Sqlstatement_Table(
Statement VARCHAR2(200));
Let there be only one entry in the table: the string 'Select * FROM X_Table'.
OK, and now, I want to execute this statement. Therefore, I write the following code:
DECLARE
h_var VARCHAR2(200);
BEGIN
select Statement into h_var from Sqlstatement_Table;
??? EXECUTE IMMEDIATE h_var; ???
END;
/
The variable h_var contains now the string 'Select * FROM X_Table'. It doesn't work like this; the line between ??? is not correct. But how can I transform this string in an executable SQL statement? How can I make ORACLE execute this code?
-Thanks for your help!
Jeronimo