I am extracting data from a table using execute query. now I want to store this data in some variable to use it for other operation, and I cannot use temp table so I have to use WITH query.
--Something like this:
with ttable (col1, col2) as (execute 'select tcol1, tcol2 from tab_sample')
insert into tab_sam2 select col1,col2 from ttable;
Now this gives me error at execute saying syntax error at or near execute.
How can I do that. Also, Is there any alternate to store multiple data coming from a table in a procedure/function without using array or temp table?