I'm trying to write a select statement in a LOOP that would select from a variable instead of a table, for example:
if i have a variable called my_var contains a value 'SCHOOL_LIST' (which is a table name in the database)
how can I write a select statement so that the below would work:
Select schoolname from my_var;
(the variable is being populated via a cursor)
plse help me ..Thanks
look at EXECUTE IMMEDIATE to execute a dynamic sql string you create at run time, as indicated in your question.
Hey I would prefer to use ref cursors for that purpose..That will handle u r problem efficiently..
Click Here to Expand Forum to Full Width