In my dynamic sql can the using clause be a part of sql statement. This is my small script. In this script using clause is also fetched from the table and sql statement is executed. But it gives error. Is this possible ?
If i remove the using clause and open the cursor explicitly giving USING clause it works ?
Please help. This is very very urgent.
set serveroutput on
FROM tms_statement_definition tsd
WHERE tsd.prg_nm = 'uoq1101'
AND tsd.format_cd = 'AA'
AND tsd.section_typ_cd = 'DT2';
The using clause is not put into the string which holds your sql and is part of the open statement.
OPEN c_Read_Data FOR v_Sql_Stmnt USING v_var1;
Now for your generic code youll either have to have the same bind variables everytime or dont bother using the USING clause and just put the variables in as literals. Of course if you are going to execute this dynamic sql a lot then it is going to bve very inefficient, if its just occasionally the overhead of hard parsing isnt going to be that great.