Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Set a column value in a trigger before insert or update.

$
0
0

I'm having trouble with triggers. I want to set the value in a column based on other columns in the row and a lookup to another table. It looks like HANA doesn't let me change the value of the column before I insert the row. I've tried BEFORE and AFTER INSERT, BEFORE and AFTER UPDATE.

I get a sql syntax error  Here is the trigger:

 

 

CREATE TRIGGER "SRC_XXX"."F0001_TRG" BERFORE INSERT ON "SRC_XXX"."F0001" REFERENCING NEW ROW mynewrow

FOR EACH ROW

BEGIN

 

DECLARE

     v_abat1 NCHAR(3);

 

 

     select abat1 into v_abat1 from src_xxx.f1111

     where aban8 = :MYNEWROW.wan8

       and abat1 in ('Q', 'Z');

 

     if :v_abat1 = 'E' or :v_abat1 = 'S' or :v_abat1 = 'X' then

          MYNEWROW.EDW_WWTYC := 'X';

     else

          MYNEWROW.EDW_WWTYC := :MYNEWROW.WWTYC;

     end if;

 

END;

    

Thanks,

Clive


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>