Re: How to identify package owner within a PL/SQL package procedure
From: Michel Cadot <micadot_at_netcourrier.com>
Date: 2000/06/07
Message-ID: <8hlunb$2l7f$1_at_s2.feed.news.oleane.net>#1/1
Date: 2000/06/07
Message-ID: <8hlunb$2l7f$1_at_s2.feed.news.oleane.net>#1/1
you can get the owner id of the package with:
select userenv('SCHEMAID') into ownerid from dual;
and the owner name with:
select username into ownername from all_users
where user_id=userenv('SCHEMAID');
v734> create or replace procedure get_us as
2 ownername varchar2(50);
3 begin
4 select username into ownername from all_users
5 where user_id=userenv('SCHEMAID');
6 dbms_output.put_line(ownername);
7 end;
8 /
Procedure created.
v734> set serveroutput on size 100000
v734> exec get_us
MMA$EP34087
PL/SQL procedure successfully completed.
v734> connect system
Connected.
v734> exec mma$ep34087.get_us
MMA$EP34087
PL/SQL procedure successfully completed.
-- Have a nice day Michel tcarey_at_prodigy <tony.carey_at_prodigy.net> a écrit dans le message : 8hlr88$4r06$1_at_newssvr04-int.news.prodigy.com...Received on Wed Jun 07 2000 - 00:00:00 CEST
>
> To anyone who can help:
>
> I have a DB user 'A', that have execution rights to a package that DB user
> 'B' owns.
>
> When DB user 'A' executes a procedure in the package, it uses the Oracle
> 'USER' function to identify who he is. But I also need to know the owner
> of the package while I am executing the procedure. Is there another Oracle
> function or query that I can invoke within the procedure that will tell me
> who the owner of the package is?
>
> DB user 'B' has the DBA role assigned to it. Keep in mind, that when DB
> user 'A' executes the procedure it executes it with DB user 'B' privileges.
>
> Any help would be greatly appreciated!
>
>
>