HANA 创建Triggers语法:
CREATE TRIGGER <trigger_name> <trigger_action_time> <trigger_event> ON <subject_table_name> [REFERENCING <transition_list>] [<for_each_row>] BEGIN [<trigger_decl_list>] [<proc_handler_list>] <trigger_stmt_list> END
例子:
CREATE TABLE TARGET ( A INT);
CREATE TABLE SAMPLE ( A INT);
CREATE TRIGGER TEST_TRIGGER_WHILE_UPDATE
AFTER UPDATE ON TARGET
BEGIN
DECLARE found INT := 1;
DECLARE val INT := 1;
WHILE :found <> 0 DO
SELECT count(*) INTO found FROM sample WHERE a = :val;
IF :found = 0 THEN
INSERT INTO sample VALUES(:val);
END IF;
val := :val + 1;
END WHILE;
END;
触发器