|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
帮忙修改触发器
CREATE OR REPLACE TRIGGER GTTEST.WRITEBACK
AFTER UPDATE OF FBILLSTATUS
ON GTTEST.T_ST_WEIGH
REFERENCING OLD AS OLD NEW AS NEW_VALUE
FOR EACH ROW
declare fidWeighNoticeBillentry varchar(50);
fidPostRequestion varchar(50);
fidWeighNoticeBillentr varchar(50);
YGBNumber number(20,4);
QTYNumber number(20,8);
begin
dbms_output.put_line(:OLD.fsourcebizbillid);
select fsourcebillid into fidWeighNoticeBillentry from T_ST_WeighNoticeBillentry
where fparentid=:OLD.fsourcebizbillid;
select fjnwygbnumber,fqty into YGBNumber, QTYNumber from T_SD_PostRequisitionentry
where fparentid=fidWeighNoticeBillentry;
update T_SD_PostRequisitionentry set fjnwkfhnumber=QTYNumber-(YGBNumber-:OLD.fsuttle),
fjnwygbnumber=YGBNumber-:OLD.fsuttle
where fparentid=fidWeighNoticeBillentry;
end;
/
对一个表的字段修改后,修改另外表的字段。
update t_st_weigh set fbillstatus=2 where fbillstatus=3;是报错
这个是简化了的建表语句
CREATE TABLE "GTTEST"."T_ST_WEIGH"
( "FID" VARCHAR2(44) NOT NULL ENABLE,
"FBILLSTATUS" NUMBER(10,0),
"FSUTTLE" NUMBER(28,10) DEFAULT 0,
"FSOURCEBIZBILLID" NVARCHAR2(80))
CREATE TABLE "GTTEST"."T_ST_WEIGHNOTICEBILLENTRY"
( "FPARENTID" VARCHAR2(44),
"FSOURCEBILLID" NVARCHAR2(80))
CREATE TABLE "GTTEST"."T_SD_POSTREQUISITIONENTRY"
( "FPARENTID" VARCHAR2(44),
"FQTY" NUMBER(28,16) DEFAULT 0,
"FJNWKFHNUMBER" NUMBER(28,4),
"FJNWYGBNUMBER" NUMBER(28,4))
insert into t_st_weigh values('A00001',3,33.333333,'B00001')
insert into T_ST_WEIGHNOTICEBILLENTRY values('B00001','C00001')
insert into T_SD_POSTREQUISITIONENTRY values('C00001',55.331,null,0)
要求在表T_ST_WEIGH的FBILLSTATUS变化后触发,
表T_SD_POSTREQUISITIONENTRY 中的FJNWYGBNUMBER=FJNWYGBNUMBER-FSUTTLE
表T_SD_POSTREQUISITIONENTRY 中的FJNWKFHNUMBER=FQTY-(FJNWYGBNUMBER-FSUTTLE)
请高手帮忙分析一下错误 |
|