Tuesday, September 30, 2014

Allow Admin users to Insert/Update/Delete on certain table



Allow Admin users to Insert/Update/Delete on certain table
How to create a trigger in oracle which will restrict insertion and update queries on a table based on a condition

CREATE OR REPLACE TRIGGER SIEBEL.BLOCK_NON_ADMIN_ACCESS
BEFORE DELETE OR INSERT OR UPDATE
ON SIEBEL.CX_ERROR_LOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
    IF sys_context('USERENV','SESSION_USER') NOT IN ('SADMIN', 'EIMUSER') THEN
        RAISE_APPLICATION_ERROR(-20000, 'You are not allowed to update table CX_ERROR_LOG. Please contact Application Support.');
    END IF;
END;

1 comment:

  1. Thanks for sharing, nice post! Post really provice useful information!

    Giaonhan247 chuyên dịch vụ mua hàng mỹ từ dịch vụ order hàng mỹ hay nhận mua nước hoa pháp từ website nổi tiếng hàng đầu nước Mỹ mua hàng ebay ship về VN uy tín, giá rẻ.

    ReplyDelete