我正在使用这种语法
CREATE TRIGGER tgBook
INSTEAD OF INSERT ON "SYSTEM"."BOOK"
FOR EACH ROW
BEGIN
INSERT INTO "SYSTEM"."CLASSA" (rollNo, name, percentage)
SELECT rollNo, name, percentage
FROM INSERTED
INSERT INTO "SYSTEM"."ClassB" (english, maths)
SELECT english, maths
FROM INSERTED
END
我收到了这个错误
Could not execute 'CREATE TRIGGER tgBook INSTEAD OF INSERT ON "SYSTEM"."BOOK" FOR EACH ROW BEGIN INSERT INTO ...'
SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "INTO": line 8 col 8 (at pos 206)
我正在使用HANA数据库并且在HANA数据库中正常的SQL触发器查询不起作用所以我需要正确的语法欢迎任何建议谢谢
我得到的解决方案实际上语法是错误的。实际的语法是
CREATE TRIGGER "SYSTEM"."tgBook" INSTEAD OF INSERT ON "SYSTEM"."BOOK" REFERENCING NEW ROW NEW FOR EACH ROW
BEGIN INSERT
INTO ClassA (rollNo,
name,
percentage) VALUES(:NEW.rollNo,
:NEW.name,
:NEW.percentage)
;
INSERT
INTO ClassB (rollNo,
english,
maths) VALUES(:NEW.rollNo,
:NEW.english,
:NEW.maths)
;
END
;