我的第一个oracle触发器
生活随笔
收集整理的這篇文章主要介紹了
我的第一个oracle触发器
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
觸發(fā)器trigger,
實(shí)現(xiàn)插入或者更新時年齡>120則age=-1
create or replace trigger TB_USER_TRIG_UPbefore update or inserton TB_USERfor each row -- --這里是關(guān)鍵的地方,在變量申明的地方,指定自定義事務(wù)處理。 -- declare -- pragma autonomous_transaction;beginif :new.age>120 then -- update TB_USER set age=-1 where age >120;:new.age:=-1;end if; -- 顯式提交事務(wù) -- commit;end;認(rèn)識了一些新的關(guān)鍵字:
declare set :new :old then when exception progma autonomous_transactionreplace trigger before/after了解一些,后期再學(xué)習(xí)
總結(jié)
以上是生活随笔為你收集整理的我的第一个oracle触发器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle的md5加密
- 下一篇: 汇编-子程序参数传递的三种方式-寄存器法