主题:(急!!!)一个ORACLE触发器,帮忙查查是什么错误
CREATE OR REPLACE TRIGGER CLIMB."c_TRG_DY_INAUP"
BEFORE UPDATE OR INSERT
ON CLIMB."楼盘初始_单元"
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
--临订
if old.状态<>'临订' and new.状态='临订' then
insert into "CLIMB"."tmpSendCusLD"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
--认购
else if old.状态<>'认购' AND NEW.状态='认购'
THEN
insert into "CLIMB"."tmpSendCusRG"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
--签合同
else if old.状态<>'签合同' AND NEW.状态='签合同'
THEN
insert into "CLIMB"."tmpSendCusQHT"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
end if
END;
BEFORE UPDATE OR INSERT
ON CLIMB."楼盘初始_单元"
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
--临订
if old.状态<>'临订' and new.状态='临订' then
insert into "CLIMB"."tmpSendCusLD"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
--认购
else if old.状态<>'认购' AND NEW.状态='认购'
THEN
insert into "CLIMB"."tmpSendCusRG"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
--签合同
else if old.状态<>'签合同' AND NEW.状态='签合同'
THEN
insert into "CLIMB"."tmpSendCusQHT"('认购书ID','认购书号','客户姓名','单元ID','移动电话')
SELECT "CLIMB"."销售管理_认购书"."认购书ID", "CLIMB"."销售管理_认购书"."认购书号",
"CLIMB"."销售管理_认购书"."业主姓名", "CLIMB"."销售管理_认购书"."单元ID", "CLIMB"."销售管理_认购书"."移动电话"
FROM "CLIMB"."销售管理_认购书"
WHERE "CLIMB"."销售管理_认购书"."单元ID"=OLD."单元ID"
end if
END;