惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Recent Announcements
Recent Announcements
雷峰网
雷峰网
The GitHub Blog
The GitHub Blog
罗磊的独立博客
月光博客
月光博客
J
Java Code Geeks
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
U
Unit 42
C
Check Point Blog
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
大猫的无限游戏
大猫的无限游戏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog

博客园 - wzc998

Oracle Audit 关于varchar2在pl/sql和schema级别的最大值 ORA-01031 权限不足错误的解决 通过代码备份存储过程,package body 和表数据 并还原 XSL ASP .net实现松耦合事件的三种方法 Log4net不同版本在app.config和web.config的配置区别 SQL*Loader FAQ 【转】NLS 视图的研究 oracle多语言环境下to_date时间转换问题 【转】如何使用 ADO.NET 和 Visual C# .NET 调用带参数的存储过程 【转】SQL SERVER 存储过程学习笔记 【转】代码复用原则:合理使用类组合和类继承 委托与接口的关系 IOC 【转】范式 【转】oracle范式与交叉表 oracle存储过程返回交叉表(使用存储过程/高级语言调用)
关于"cannot perform a DDL, commit or rollback inside...
wzc998 · 2011-08-16 · via 博客园 - wzc998

error scenario:

update a set field1 = functionA() where ...

function functionA return varchar2 as

begin

...

 -- may be

 raise_application_error(-20000,'TEST');

...

EXCEPTION

 WHEN OTHERS THEN

  log_to_table(...)

  Commit;

end functionA;

Most of the time, functionA will not cause any problem. It log into log table when error happens inside of it. And commit the log.

But , Some time it will cause issue when functionA was called from an update statement(DML statement) as a value passed to "set" clause.

cause: DDL operations like creation tables, views etc. and transaction control statements such as commit/rollback cannot be performed inside a query or a DML statement

Resolve solution:

1, in this situation we can apply "autonomous transaction" to log_to_table, and remove the "Commit" . this solution will cause some performance loss.

2, remove "commit". "commit" transaction after "update..."(DML).