DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Error creating a trigger in a pl/sql block

  1. #1
    Join Date
    Jan 2001
    Posts
    28
    I need to create a trigger inside a pl/sql block. When I do it inside an anonymous block, it works perfect, the trigger is created and all. If I name the procedure and try to compile it, it says "Insufficient Privileges" at times or "Table or View does not exist". Has anyone faced this kind of problem ?

    The query is as below, comment the create portion for the trigger to be created and comment the declare portion to see the error.

    declare
    create or replace procedure create_tr as
    hand integer := dbms_sql.open_cursor;
    v_string varchar2(2000);
    feed integer;
    begin
    v_string := 'create or replace trigger wsbenadmin.test_tr '||
    ' before insert on wsbenadmin.tbl_master for each row '||
    'begin Null; end;';

    dbms_sql.parse(hand,v_string,dbms_sql.native);
    feed := dbms_sql.execute(hand);
    dbms_sql.close_cursor(hand);
    end;
    /
    - Mayur.

  2. #2
    Join Date
    Jul 2000
    Posts
    296
    Does the owner of the procedure has CREATE TRIGGER privilege granted to her/him directly and not through a role.
    Roles are not visible in stored procedures.

  3. #3
    Join Date
    Jan 2001
    Posts
    28
    The user is a DBA user and the trigger works fine from an anonymos block. It fails only when I give a name to the procedure.
    - Mayur.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width