Abort inserting a record in a table using a trigger
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,
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.
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).
Click Here to Expand Forum to Full Width