Hi everyone hope you're doing well.
AS you might know by now I'm new to PL/SQL and I'm trying to write a trigger
as you can see below :
CREATE OR REPLACE TRIGGER T_Insert
AFTER INSERT ON tag
for each row
BEGIN
Select case
WHEN EXISTS (Select tag , brand_id
from my_tags
where tag = :new.tag AND
brand_id = :new.brand_id) THEN
UPDATE my_tags set count := count +1
ELSE
insert into my_tags (sr_no,tag,count,brand_id)
valuse (:new.sr_no , :new.tag ,1 , :new.brand_id)
end case AS SS
from dual;
END;
When I want to run the code and create the trigger I receive these errors:
ORA_00936 : missing expression. (Line 15) update statement
SQL statement ignored
am I using the Select Case
and When Exists
The wrong way?
Best Answer
try this one