I need to figure out how to determine, from within code in a PL/SQL package, the owner of the package. The Oracle USER function returns the userid of the user running the session. Since Oracle uses a definer-rights system, where running code executes as the code's owner instead of the code's executer (unless otherwise specified), I thought I could just include a call to USER and would receive the name of the owner. This does not appear to work, at least for a standalone function on the server (although I'll be trying within the package itself in a minute).
all_source (Score:2)
PACKAGE_NAMEby the real name of your package) and you'll probably be closer to home. If you're allowed to touch that source.Well, you probably can work something out from there.
Re: (Score:2)
But the problem I was trying to resolve involved an identical package in two different schemas, which in that solution would result in duplicate results from ALL_SOURCE, and leave me with the same conundrum.
FWIW, there's a record in ALL_SOURCE for every line of code. A quicker query to get the same result would be FROM all_objects WHERE object_type = 'PACKAGE'
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
One uses what one has used before, and I had used ALL_SOURCE (and USER_SOURCE) but not the many other stuff in a similar vein. In the meantime, I've played a little with other options, and I found that
type='PACKAGE'instead oftype='PACKAGE BODY', because the latter only shows items you have write access to (usually just your own packages), while the former shows you allRe: Oracle package ownership (Score:2)
I wasn't able to reply earlier so I created a journal entry of my own with the same title: Oracle Package Ownership [perl.org].
Re: (Score:2)
Thank you!! I believe SYSCONTEXT is the solution I was looking for (although I was able to synthesize another workaround this afternoon, but it still didn't solve this problem in the general case).
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
You're welcome. :)
Using the SYS_CONTEXT [psoug.org] function with the USERENV namespace has replaced the old USERENV [psoug.org] function.