oracle For循环和触发器Tigger
生活随笔
收集整理的這篇文章主要介紹了
oracle For循环和触发器Tigger
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
--循環(huán)
begin? for cycle in (select id, testcycle from specialpapers) loop
? ? if (cycle.testcycle is null) then
? ? ? update specialpapers set testcycle = 48 where id = cycle.id;
? ? end if;
? end loop;
end;
for循環(huán),是一種隱式游標(biāo),效率比較高,編寫使用方便。
--觸發(fā)器create or replace trigger test
? before insert or update on specialpapers
? for each row
declare
? -- local variables here
begin
? if :NEW.Testcycle is null then
? ? :NEW.Testcycle := 48;
? end if;
end test;
--刪除觸發(fā)器
DROP TRIGGER test;
--授權(quán)用戶 調(diào)試權(quán)限
GRANT debug any procedure, debug connect session TO username
總結(jié)
以上是生活随笔為你收集整理的oracle For循环和触发器Tigger的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 短视频剪辑自学小技巧,掌握并运用,让你的
- 下一篇: 自学python推荐廖雪峰网站