Skip to Content
0

Oracle to Hana Migration: Flags in trigger

Jan 10, 2017 at 07:56 AM

151

avatar image
Former Member

Hi,

Using Hana Express edition with following version details.

HDB version info: version: 1.00.122.01.1470046197

branch: fa/hana1sp12

git hash: 78cfc48c559a44c16cd06e425fa74b67b2e14c7d

git merge time: 2016-08-01 12:09:57

weekstone: 0000.00.0

compile date: 2016-08-01 12:21:05

compile host: ld7272

compile type: rel

Trying to convert an Oracle trigger to Hana and facing following issue.

Oracle PL/SQL provides three flags INSERTING, UPDATING and DELETING for identifying the triggering event, inside the trigger body - thus allowing different logics to be written based on event.

I am trying to find an equivalent in Hana but I have failed to find one so far.

Here is the code that I have come up with so far.

>>

CREATE TRIGGER SCHEMA.TRIGGERNAME

AFTER INSERT OR UPDATE OR DELETE

ON SCHEMA.TABLENAME

REFERENCING NEW ROW NEWROW, OLD ROW OLDROW

FOR EACH ROW

BEGIN

if INSERTING THEN -- looking for equivalent flag here

CALL PROCEDURE1;

End if;

If UPDATING THEN -- looking for equivalent flag here

CALL PROCEDURE2;

End if;

IF DELETING THEN -- looking for equivalent flag here

CALL PROCEDURE3;

END IF;

END;

>>

Please direct me to an appropriate link if there is an equivalent available in Hana, else provide some inputs as to how this can be achieved (of course, writing three different triggers would be the obvious solution).

Regards,

Satish

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Lars Breddemann
Jan 14, 2017 at 09:23 AM
0

SAP HANA does provide triggers (reading the documentation gives more details on that), but I seriously recommend to rethink your solution. Triggers tend to be rather problematic (in Oracle and all DBMS as much) and are often used to achieve some high level goal (e.g. integration) for which better tools exist.

Share
10 |10000 characters needed characters left characters exceeded