plsql只提交存储过程里的事务,在oracle中执行存储过程后是否发生任何自动提交?...

I have 3 tables in oracle DB. I am writing one procedure to delete some rows in all the 3 tables based on some conditions.

I have used all three delete statements one by one in the procedure. While executing the mentioned stored procedure, is there any auto-commit happening in the at the time of execution?

Otherwise, Should I need to manually code the commit at the end?

解决方案

There is no auto-commit on the database level, but the API that you use could potentially have auto-commit functionality. From Tom Kyte.

That said, I would like to add:

Unless you are doing an autonomous transaction, you should stay away from committing directly in the procedure: From Tom Kyte.

Excerpt:

I wish PLSQL didn't support commit/rollback. I firmly believe

transaction control MUST be done at the topmost, invoker level. That

is the only way you can take these N stored procedures and tie them

together in a transaction.

In addition, it should also be noted that for DDL (doesn't sound like you are doing any DDL in your procedure, based on your question, but just listing this as a potential gotcha), Oracle adds an implicit commit before and after the DDL.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值