Authid Currentuser Vs Pragma Authid Definer
Authid Currentuser Vs Pragma Authid Definer
Authid Currentuser Vs Pragma Authid Definer
authid definer
as begin
null;
end p_authid_d;
/
connect a/a;
commit;
grant select on t to b;
-- no grant on u
create procedure pt
authid current_user
as
v_d t.d%type;
begin
http://www.adp-gmbh.ch/ora/plsql/authid.html (3 of 5)4/28/2010 2:28:25 PM
authid current_user vs pragma authid Definer
create procedure pu
authid definer
as
v_d t.d%type;
begin
select d into v_d from u;
dbms_output.put_line(v_d);
end;
/
grant execute on pt to b;
grant execute on pu to b;
connect b/b;
commit;
set serveroutput on
http://www.adp-gmbh.ch/ora/plsql/authid.html (4 of 5)4/28/2010 2:28:25 PM
authid current_user vs pragma authid Definer
Effects on roles
A procedure with authid definer disables all roles
that are granted to the caller. This can lead to ora-
00942 errors.
If the procedure is created with authid current_user,
the roles of the caller are enabled when the procedure
is executed. However, in order to compile the
procedures, the privileges still need to be granted
directly.