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!

make only insert in a table, no Update and no delete

user560737Feb 24 2021 — edited Feb 24 2021

Hello to all
is there a way to insert rows in a table also when I run Update?

That I'll try to explain me better

In my case, i want ignore updating I always want to do inserting also if row exists, something as

WHERE EXISTS insert

ignore ORA-00001: uniqueconstraint(...) violate
and insert a new key(egmax(key) +1 and then insert

I want for a table only row's insert, no update and no delete

CREATE OR REPLACE TRIGGER "TG_ACL1" AFTER INSERT OR UPDATE OR DELETE ON ACL1
   for each row
BEGIN
     IF INSERTING THEN
        INSERT INTO acl1 VALUES ....
     ELSIF UPDATING THEN
         INSERT INTO acl1 VALUES .... (
     ELSIF DELETING THEN
        null;
   END IF;
END;

Thanks in advance

Comments
Post Details
Added on Feb 24 2021
7 comments
1,736 views