Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Who's the procedure owner?

Re: Who's the procedure owner?

From: Luis Cabral <luiscabral_at_starmedia.com>
Date: Mon, 28 Aug 2000 11:41:53 GMT
Message-ID: <8odj5v$slj$1@nnrp1.deja.com>

Thank you and also Mark for the responses.

My proc receive a table name as parameter, and I have to access the datadictionary to get all columns for that table. But, in ALL_TAB_COLUMNS, besides the table name I must know its owner. Of course, depending on the privileges of the connect user, he can see many entries for a same *table name* in that view, of different owners. By my rule, the table owner must be the same owner of the proc. As I want make it very portable, I do not want hardcode any user name in it.

The userenv('schemaid') really works (but I could not find any reference to it (schemaid parm) in the documentation - how did you find out?).

Other solution I was thinking about is the following: the user accessing the proc must be using a synonym (public or private) - it is a rule. So, I could look in:
- user_objects, in the case the owner itself is calling   its proc
- user_synonyms, for a private synonym
- dba_synonyms, for a public synonym

But the userenv solution is sure more elegant.

Thank you

In article <%cfq5.2953$k57.229871_at_news.flash.net>,   "Nascar" <nascar_at_flash.net> wrote:
> How about:
> select userenv('schemaid') from dual?
>
> "Luis Cabral" <luiscabral_at_starmedia.com> wrote in message
> news:8o65dr$t2e$1_at_nnrp1.deja.com...
> > Hello
> >
> > Say user1 has a procedure called proc1 in the database.
> > Say user2 has the very same procedure, also called proc1.
> > Say user3 is executing the procedure proc1. By the way,
> > user3 can be accessing user1.proc1 or user2.proc1,
> > depending on how the synonyms are defined, ok?
> >
> > Inside proc1, how can I know on which schema the
> > procedure is running (user1 or user2)? If I use the
> > "user" function, I will get "user3" (the connected
> > user).
> >
> > Thank you
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Aug 28 2000 - 06:41:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US