Unfortunately I couldn't get the attachment link to work. Here are the script contents:
-- DROP TABLE Aircraft_Test;
CREATE TABLE Aircraft_Test (
Registration CHAR(6) NOT NULL ,
Make CHAR(25) NOT NULL ,
Model CHAR(25) ,
Type CHAR(25) NOT NULL ,
Most_Recently_Used TIMESTAMP ,
COMMENTS VARCHAR (255)
, CONSTRAINT Aircraft_PK PRIMARY KEY (Registration)
)
IN DATA_TS
INDEX in INDEX_TS
LONG IN IMAGE_TS
#
CREATE TRIGGER MOST_RECENT_INSERT
AFTER INSERT ON Aircraft_Test
REFERENCING NEW AS New_id
FOR EACH ROW
SECURED
-- MODE DB2SQL
BEGIN ATOMIC
-- update airfield set MOST_RECENTLY_USED =
-- (select max(brakes_off)
-- from logbook
-- where From_Airfield = Code)
-- where From_Airfield = New_Id.From_Airfield
-- ;
-- update aircraft a set MOST_RECENTLY_USED =
-- (select max(brakes_off)
-- from logbook b
-- where a.registration = b.registration )
-- where a.Registration = New_Id.Registration
-- ;
-- select tabschema, tabname, owner from syscat.tables where tabschema='LOGBOOK' ;
END#
note that most of the 'real' processing is now commented out