Hi There,
i am trying to create a Trigger. The Trigger should be executed on an "AFTER INSERT ON <TABLE> REFERENCING NEW ROW CURRENTMESSAGE FOR EACH ROW"
This works well for a limited version of my task, so the trigger gets created.
BUT when I want to iterate through a select statement to get some values from another table and add a Cursor inside the trigger ...
DECLARE CURSOR cursor_GeoFence FOR
SELECT * FROM "GEOFENCES";
FOR cursor_row as cursor_GeoFence DO
LAT_geofence := :cursor_row.GEOFENCE_LATITUDE;
LON_geofence := :cursor_row.GEOFENCE_LONGITUDE;
RADIUS_geofence := :cursor_row.GEOFENCE_RADIUS;
NAME_geofence := :cursor_row.GEOFENCE_NAME;
GFID_geofence := cursor_row.GEOFENCE_ID;
...
<do something for example insert into event table>
END FOR;
i get an error "Error: (dberror) 257 - sql syntax error: incorrect syntax: line 14 col 12 (at pos 736)" which is the line before the "DECLARE CURSOR" line. And when i put a block comment around that DECLARE-FOR Statement it works. So somehow the problem must be inside the above Cursor - FOR Statement.
Any ideas how I can solve that issue?
Maybe there is an alternative to do a "SELECT" statement and iterate through the resultset within a trigger?
Thanks!
pascal