select from all_tables inside a procedure brings a different result set
569317Aug 30 2007 — edited Aug 30 2007Hi all,
There are two cases.. both are the same, but gives different out put.
CASE 1 pulls few for SYS and all for current user.
CASE 2 Pulls data for ALL USERS.
Why the same code in side a procedure brings a different result ?
SQL>
--CASE 1
CREATE OR REPLACE procedure test_t_owner as
cursor cur1 is select table_name,owner from all_Tables;
begin
for rec1 in cur1
loop
dbms_output.put_line(rec1.table_name||'--'||rec1.owner);
end loop;
end;
/
set serveroutpu on;
exec test_t_owner
--CASE 2
Declare
cursor cur1 is select table_name,owner from all_Tables;
begin
for rec1 in cur1
loop
dbms_output.put_line(rec1.table_name||'--'||rec1.owner);
end loop;
end;
/
- regards
sk