Sample Header Ad - 728x90

Oracle 19c - Multiple If Conditions

0 votes
0 answers
240 views
create or replace TRIGGER trigger_name ... ... BEGIN IF SYS_CONTEXT (...) IN (...) THEN IF SYS_CONTEXT (...) NOT IN (...) THEN IF SYS_CONTEXT (...) NOT IN (...) THEN INSERT INTO owner.table_name (...) VALUES (...); COMMIT; RAISE_APPLICATION_ERROR(...); END IF; END IF; END IF; END; As I mentioned above, there is a trigger. Trigger should run and insert in the table when it doesn't provide even 1 of the if condition containing 2 not ins. However, when 1 of these 2 not in conditions is met, the trigger does not work as I want. How can I provide this? If even 1 of the 2 conditions is not met, the trigger should run. The following table describes the logic of the trigger. * *1st condition is met* means that SYS_CONTEXT (...) IN (...). * *2nd condition is met* means that SYS_CONTEXT (...) NOT IN (...). * *3nd condition is met* means that SYS_CONTEXT (...) NOT IN (...). Table: 1st condition is met | y | y | ... 2nd condition is met | y | y | 3rd condition is met | y | y | execute insert | ? | ? |
Asked by jrdba123 (29 rep)
Aug 17, 2022, 09:38 AM
Last activity: Aug 17, 2022, 10:08 AM