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

Thread: Abort inserting a record in a table using a trigger

  1. #1
    Join Date
    Dec 2005
    Posts
    2

    Question Abort inserting a record in a table using a trigger

    Hi there,
    Is there any way to abort inserting a record in a table using a trigger?
    For full details, I have the following table ("myTable"):

    BSC INTEGER NOT NULL,
    BTS VARCHAR2(20) NOT NULL,
    INFO1 INTEGER,
    INFO2 INTEGER

    myTable_PK = PRIMARY KEY (BSC,BTS)

    I have also a stored procedure that imports a data from text file and inserts them to the specified table (using UTL_FILE package). The stored procedure works great.
    But the thing that in the text file itselft it might be (due to third-parity report generation bug) that the primary key will be violated or the BSC/BTS field has null value. In such case I just want to ignore the insertion statement using a trigger.

    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    London, UK
    Posts
    159
    No. If the trigger fails, the INSERT fails with an error condition. If it succeeds, the record goes in.

    The load procedure would be the place to handle this, unless you can make it a SKIP condition in the external table (though this cannot handle a PK violation).

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