Solved

Identify User Rights on Oracle package

Posted on 2011-09-28
4
266 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
levels for reporting 5 78
Oracle - Create Procedure with Paramater 16 65
Query to identify changes between rows of two tables 8 49
make null the repeated levels 2 25
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

831 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