Hello,
Trying to execute a query with dynamic bind variables like as follows:
I have two set of tables say TAB_QUERY and TAB_PARAMETERS.
TAB_QUERY has a column query_text and will be used to save queries
i.e, SELECT * FROM EMP WHERE EMPNO=:1 and DEPTNO=:1 and ENAME=:3
TAB_PARAMETERS store the passing parameters list in multiple rows for the corresponding query.
1234
10
'SCOTT'
so, the plan is to run the query with the list of parameters inserted in the TAB_PARAMETERS table.
declare
cursor c is
select query_text from TAB_QUERY;
cursor c_param (InParam IN NUMBER) is
select * from TAB_PARAMETERS where query_id = InParam ;
begin
For Indx in C LOOP
FOR Jndx IN c_param(Indx.Query_id)
Execute immediate Jndx.query_text using ????
END LOOP;
END LOOP;
end;
Is there any way to make this program run?
Thanks