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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

select from all_tables inside a procedure brings a different result set

569317Aug 30 2007 — edited Aug 30 2007
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2007
Added on Aug 30 2007
8 comments
879 views