Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Location
    Hartford, CT
    Posts
    106

    Question Unanswered: Disabling a trigger in a script

    Hi,

    Is there a way to disable a trigger in the middle of a script or a program before executing a certain query and enabling it after the query takes place? For example, updating a "status field" to disable before and to enable after.

    Thanks
    Mo

  2. #2
    Join Date
    Oct 2002
    Location
    greenwich.ct.us
    Posts
    279
    CAN you do it? Sure. http://download-west.oracle.com/docs...4a.htm#2057817

    SHOULD you do it? Probably not. A trigger is usually implemented to ensure data integrity. Bypassing this trigger may mess up the data in your database.

  3. #3
    Join Date
    Oct 2002
    Location
    Hartford, CT
    Posts
    106
    Originally posted by marist89
    CAN you do it? Sure. http://download-west.oracle.com/docs...4a.htm#2057817

    SHOULD you do it? Probably not. A trigger is usually implemented to ensure data integrity. Bypassing this trigger may mess up the data in your database.
    Hi,

    I did that and I got this error:

    ERROR at line 25:
    ORA-06550: line 25, column 2:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
    begin declare exit for goto if loop mod null pragma raise
    return select update while <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall
    <a single-quoted SQL string>

    Any idea why?
    thanks
    Mo

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    In PL/SQL you cannot do DDL directly, you would have to use:
    DBMS_UTILITY.EXEC_DDL_STATEMENT( 'ALTER TRIGGER t DISABLE' );

  5. #5
    Join Date
    Oct 2002
    Location
    Hartford, CT
    Posts
    106
    Originally posted by andrewst
    In PL/SQL you cannot do DDL directly, you would have to use:
    DBMS_UTILITY.EXEC_DDL_STATEMENT( 'ALTER TRIGGER t DISABLE' );

    Thanks a lot, that worked great.
    Mo

Posting Permissions

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