need to understand the authid current_user syntax, and when to use
Answer: The authid current_user
is used when you want a piece of code (PL/SQL) to execute with the
privileges of the current user, and NOT the user ID that created the
procedure. This is termed a "invoker rights", the opposite of
The authid current_user is the opposite of authid
In the same sense, the authid current_user is the
reverse of the "grant execute" where the current user does
not matter, the privileges of the creating user are used.
PL/SQL, by default, run with the
privileges of the schema within which they are created no matter who
invokes the procedure. In order for a PL/SQL package to run with
invokers rights AUTHID CURRENT_USER has to be explicitly written
into the package.
To understand the authid current_user, consider this type
CREATE TYPE address_t
AS OBJECT (
The authid current_user clause
tells the kernel that any methods that may be used in the type
specification (in the above example, none) should execute with the
privilege of the executing user, not the owner.
The default option is authid definer,
which would correspond to the behavior in pre-Oracle8i releases,
where the method would execute with the privileges of the user
creating the type.
this example of authid current_user to understand how this
syntax causes invoker rights, which, in turn, changes the behavior
of the PL/SQL code.
PL/SQL code with the default authid definer, can
facilitate SQL injection attacks, because an intruder would get
privileges that they would not get if they used authid
Get the Complete
Oracle SQL Tuning Information
The landmark book
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
for 30% off directly from the publisher.