Hi Guys, I am trying to create a trigger to validate a record before it is inserted into a table.
I have the following code: CREATE OR REPLACE TRIGGER check_bom_exists_trig BEFORE INSERT OR UPDATE ON XXMEL_SPARES_BOM_LOOKUP BEGIN IF (TARGET_BOM NOT IN (SELECT msib.segment1 FROM mtl_system_items_b msib WHERE msib.ENABLED_FLAG = 'Y' AND msib.organization_id IN (169,168) ORDER BY msib.segment1) ) OR (SOURCE_BOM NOT IN (SELECT msib.segment1 FROM mtl_system_items_b msib WHERE msib.ENABLED_FLAG = 'Y' AND msib.organization_id IN (148,26) ORDER BY msib.segment1) ) THEN RAISE_APPLICATION_ERROR (-2001,'You have tried to insert records that do not exist in Oracle'); END IF; END; What I am tring to say is that if the TARGET_BOM field or the SOURCE_BOM field does not exist in the msib table then to raise the application error. As I very rarely use triggers I was wondering if one of you guys could point me in the right direction. Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---