小编Sab*_*Ram的帖子

如果没有错误则提交事务,如果在 Oracle SQL* plus 中发生错误则回滚

以下是我用来在我的数据库中部署 SQL 脚本的一小段代码。我只是想知道我是否可以根据结果自动执行此提交或回滚任务。

disc
connect username/password@database
spool D:\Deployments\path\to\logfile\logfile.log
@D:\Deployments\path\to\script\sqlquery_script.sql
Run Code Online (Sandbox Code Playgroud)

如果 sql 脚本成功运行而没有任何错误意味着我希望系统自动提交它,如果发生任何错误,所有事务都应该回滚(请注意,我的 sql 脚本有很多更新语句)

当我使用WHENEVER SQLERROR EXIT SQL.CODE ROLLBACK;SQL* plus 窗口关闭时,没有显示任何错误。

请帮助解决这个问题。

sql oracle commit oracle-sqldeveloper

0
推荐指数
1
解决办法
9804
查看次数

标签 统计

commit ×1

oracle ×1

oracle-sqldeveloper ×1

sql ×1