Solved

Identify User Rights on Oracle package

Posted on 2011-09-28
4
260 Views
Last Modified: 2012-05-12
Create or replace package pkgx authid definer
is
    executionuserrights varchar2(100) : = xxxxxxx ; -- I need the definer user name to be captured

end pkgx;



Create or replace package pkgy authid current_user
is
    executionuserrights varchar2(100) : = User; -- This captures the user name of the invoker

end pkgx;



I need something like


If userrights = 'Definer' then
    ExecutionRights := owner of the package;

elsif userrights = 'Current_user' then
    ExecutionRights := User;
end if;

0
Comment
Question by:vishali_vishu
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36717621
>>userrights = 'Definer'

I'm not understanding the question.  What do you want to capture if not who is executing the package?
0
 
LVL 73

Expert Comment

by:sdstuber
ID: 36717669
select distinct authid from user_procedures where object_name = 'YOUR_PACKAGE'

however,  you can't change it from within the package if that's what you're trying to do

you'll have to recompile it
0
 
LVL 1

Author Comment

by:vishali_vishu
ID: 36717675
I wanted the schema name to be captured to a variable while executing a package.

if package is set to definer rights

 variable = definer user name;

if package is set to current_user rights

variable= invoker user name;




0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 36717726
ah, ok that's much easier

no if necessary, just use the USERENV context

variable := sys_context('userenv','CURRENT_USER');
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PL/SQL Two statements 6 50
VB.Net - CSV to Oracle table 4 29
PAYER_ID has both atributes 4 19
Schema creation in Oracle12c 6 24
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now