<P>A表有學生基本信息(studntnum xueji 等)</P> <P>B表是更改學生學籍的,有(studentnum ,xueji 等)</P> <P>現(xiàn)在我向B表添加一條記錄,目的是更改某學生學籍,所以A表中相應學生的xueji項應該和添加在B表中的 xueji一樣,用觸發(fā)器怎么寫呢?</P>
2 回答

溫溫醬
TA貢獻1752條經(jīng)驗 獲得超4個贊
create or replace trigger B_AFTER_ALL after insert or update or delete on B for each row declare strTableName varchar(32) := 'B'; strValues varchar(256); strPrimaryKeys varchar(256); begin if UPDATING then strValues :='xueji='||:new.xueji; strPrimaryKeys := 'STUDENTNUM='||:new.STUDENTNUM; update A set strValues where strPrimaryKeys; end if; exception when others then null; end B_AFTER_ALL; /
- 2 回答
- 0 關(guān)注
- 379 瀏覽
添加回答
舉報
0/150
提交
取消