第一次写oracle触发器,根据网上说的格式写完了运行,报错,创建成功编译错误
CREATE
OR REPLACE TRIGGER fr_cs before INSERT ON tc_ggm_file FOR each ROW
BEGIN
INSERT INTO tc_gge_file ( tc_gge01, tc_gge02, tc_gge03, tc_gge04, tc_gge05, tc_gge06, tc_gge07 )
SELECT
tc_gge01,
tc_gge02,
tc_gge03,
tc_gge04,
tc_gge05,
tc_gge06,
: new.tc_ggm01 ---拿触发器表的字段填入tc_gge07
FROM
tc_gge_file
WHERE
tc_gge01 :=: new.tc_gge01
AND tc_gge07 :=: new.tc_gge07;
END;
运行结果及报错内容
试着写了几种都报错了,没得办法了,想向社区问问
逻辑:如果tc_ggm_file插入数据,则tc_gge_file,复制最大版本号的数据到新版本上,版本号新旧 都是通过tc_ggm_file 获取
就是当tc_ggm_file (版本号管理表)插入一条记录(相当于版本号升级)后tc_gge_file 复制原来的数据到新的版本上,并将复制的数据旧版本号值替换成新版本号
麻烦懂触发器的各位给看一下