Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PL/SQL conversion to with/sql

user13328581Nov 9 2020

Hello Experts;
I have the following sample code below..
SET SERVEROUTPUT ON
declare
v_cnt number;
cursor v_cur
is
select table_name,
owner
from all_tables
where rownum = 2
and owner = 'test';
begin
for v_rec in v_cur loop
execute immediate 'select * from ' ||
v_rec.owner || '.' || v_rec.table_name ||
' where 1=1';
end loop;
end;

I was wondering if this can be converted to SQL using the with clause as well. I tried getting some ideas by looking at the some of the old thread but I wasn't too successes. This is an old thread I tried using as a reference

PL/SQL Query help. (0 Bytes)
Thanks in advance

This post has been answered by mathguy on Nov 9 2020
Jump to Answer
Comments
Post Details
Added on Nov 9 2020
15 comments
207 views