oracle For循环和触发器Tigger
2016-04-05 16:57
465 查看
--循环
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循环,是一种隐式游标,效率比较高,编写使用方便。
--触发器
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;
--删除触发器
DROP TRIGGER test;
--授权用户 调试权限
GRANT debug any procedure, debug connect session TO username
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循环,是一种隐式游标,效率比较高,编写使用方便。
--触发器
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;
--删除触发器
DROP TRIGGER test;
--授权用户 调试权限
GRANT debug any procedure, debug connect session TO username
相关文章推荐
- oracle存储过程的基本语法
- Arcgis server 10.2 配置Oracle监听使用SQL操作ST_geometry
- Oracle Audit
- Oracle常用SQL语句
- 远程连接oracle进入SQLPLUS时删除键不能用
- oracle 导入导出
- Oracle ORA-01033: ORACLE initialization or shutdown in progress 错误解决办法
- 访问对方oracle数据库
- oracle11g单机静默安装
- Linux下创建用户组报错;不能进去oracle
- Oracle 11g JSON库小于1的小数输出出错BUG 修复《JSON_UTIL_PKG》
- 36、Oracle数据库的备份与恢复
- Oracle 110个常用函数
- oracle数据库-10G客户端导出11G数据文件,空表不能导出
- Navicat for Oracle 配置以及使用
- Oracle数据泵(Dump)导出、导入
- 关于oracle中传过来的一个多id需要插入到数据库用,分格的存储过程
- Oracle SQL 基础知识
- Oracle 数据库基础学习 (七) SQL语句综合练习
- maven加载oracle驱动问题