Facing Error 'Missing expression' while trying to create a After insert trigger in PL/SQL

by Pantea Tourang   Last Updated June 12, 2019 08:06 AM

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?



Related Questions






stored procedure got stuck

Updated September 07, 2017 13:06 PM