Powered By Blogger

Monday, March 14, 2011

Procedure with AUTHID "Current_user and Definer "

Check the below example and the comment. By default normally the procedure executes with AUTHID DEFINER privileges.

CREATE OR REPLACE PROCEDURE NV.test_insrt
AUTHID definer  -- executes the procedure with the privilges which the owner of the procedure has
or
AUTHID CURRENT_USER --  executes the procedure with currently logged in schema user privileges
IS
BEGIN
insert into nav1 values(12,11222);
commit;
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END test_insrt;

Regards,
Navaneeth