Monday, May 14, 2012

More About AUTHID

This was tested on an Oracle 9 database. When you create a procedure, the AUTHID column in USER_PROCEDURES records whether it was created with AUTHID CURRENT_USER or AUTHID DEFINER. The default is DEFINER:
 
SQL> create or replace procedure definer_proc
  2  authid definer is
  3  begin
  4  null;
  5  end;
  6  /
 
Procedure created.
 
SQL> create or replace procedure current_user_proc
  2  authid current_user is
  3  begin
  4  null;
  5  end;
  6  /
 
Procedure created.
 
SQL> create or replace procedure unspecified_proc is
  2  begin
  3  null;
  4  end;
  5  /
 
Procedure created.
 
SQL> select object_name, authid
  2  from user_procedures
  3  where object_name in
  4  ('DEFINER_PROC',
  5   'CURRENT_USER_PROC',
  6   'UNSPECIFIED_PROC')
  7  /
 
OBJECT_NAME                    AUTHID
------------------------------ ------------
CURRENT_USER_PROC              CURRENT_USER
DEFINER_PROC                   DEFINER
UNSPECIFIED_PROC               DEFINER
 
SQL>

No comments: