Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORA-00001: unique constraint violated On a db Trigger After insert

Amatu Allah Neveen EbrahimNov 20 2010 — edited Nov 20 2010
Hello ,

am having the following trigger working upon inserting
  CREATE or REPLACE TRIGGER transactions_insert
     AFTER INSERT ON wh_i_items
   FOR EACH ROW
   BEGIN
IF :new.BALANCE_QTY > 0 THEN     
      INSERT INTO wh_transactions
           VALUES
 (:new.store_id, (select  NVL( MAX(TRANSACTION_SERIAL) +1 ,1) from wh_transactions), 9 
    ,1 , SYSDATE , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL ,
     NULL , NULL , NULL , NULL , NULL , NULL );

END IF;

EXCEPTION
WHEN OTHERS THEN RAISE;
   end transactions_insert;
   / 

Trigger created.
The problem is :

while inserting in the table wh_i_items getting the following ,am getting this error after the first insertion of a record.


ORA-00001: unique constraint (DB.WT_NUMBER_TYPE_UK) violated
ORA-06512: at "DB.TRANSACTIONS_INSERT", line 8
ORA-04088: error during execution of trigger 'DB.TRANSACTIONS_INSERT'

am i missing something ?!

Regards,

Abdetu..
This post has been answered by Solomon Yakobson on Nov 20 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2010
Added on Nov 20 2010
24 comments
3,129 views