ORA-04082: 及 ORA-06512 异常,table trigger 影响自身修改示例
来源:互联网 发布:淘宝卖家说他补差价 编辑:程序博客网 时间:2024/05/02 15:01
1.示例表创建:
-- Create table
create table TESTTABLE
(
COL1 NVARCHAR2(4) not null,
COL2 NVARCHAR2(4)
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);
2.需求:列col2如果没有录入值,使用默认值来替换.(注:不知道什么原因,设置中文的默认值时,始终不成功,所以只好绕路实现.)
实现方式:触发器.
create or replace trigger Test_Trigger
before insert on testtable FOR EACH ROW
declare
sNameStr nvarchar2(4):='赵';--默认址
begin
if :new.col2 is null then
select sNameStr into:new.col2 from dual;
--update testtable set col2='a' where col1=:new.col1;
end if;
end Test_Trigger;
3.标题异常.
ORA-04082 触发器LEVEL问题,在非foreach row 触发器中使用了new或old.
ORA-06512 :table trigger中自身变化时再使用SQL语句修改自身记录是不被允许的.可以参照上例中,在变化前,将新变化值替换,而不要去修改已有表记录.
- ORA-04082: 及 ORA-06512 异常,table trigger 影响自身修改示例
- trigger抛出异常ORA-04091:table ...... is mutating, trigger/function may not see it
- Oracle Trigger :Before,after,each row and table level triggers ORA-04082 ORA-04084
- 关于错误:"ORA-04091: table is mutating, trigger/function may not see it"的分析(触发器操作自身表)
- 关于错误:"ORA-04091: table is mutating, trigger/function may not see it"的分析(触发器操作自身表)
- Oracle JOB异常ORA-06512
- ORA-04091: table XXXX is mutating, trigger/function may not see it
- 错误"ORA-04091: table is mutating, trigger/function may not see it"的原因以及解决办法
- ORA-04091: table name is mutating, trigger/function may not see it.
- ORA-04091: table is mutating, trigger/function may not see it
- Oracle连接超限修改,ORA-00064,ORA-12571,ORA-24324及用户连接查看
- ORA-21500,ORA-24550,ORA-01000 ,ORA-06512同时出现,问题定位及解决办法
- ora-04091 mutating table
- Oracle触发器给表自身的字段重新赋值出现ORA-04091异常
- ORA-00936 ORA-06512
- ora-29280,ora-06512
- ORA-04092: cannot COMMIT in a trigger
- ORA-39002 ORA-39070 ORA-29283 ORA-06512 ORA-29283
- 程序员建数据表
- Static和Final修饰类属性变量及初始化(转载)
- 用div做的细线表格效果
- 利用粘贴板导入数据
- VFP照像程序说明
- ORA-04082: 及 ORA-06512 异常,table trigger 影响自身修改示例
- 时间实时更新
- Ubuntu 8.0.4 下ipmessenger的安装
- Visual C++程序设计实用教程
- JavaScript正则表达式exec和test方法
- 表格中的每一行都变成连接
- UDDI:weblogic下的UDDI及对UDDI的理解
- 什么是EJB?
- input双击可以编辑,单击后还原不可编辑状态