数据在另一个/同一个会话中提交,无法更新行(Oracle SQL Developer)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10697507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:11:46  来源:igfitidea点击:

Data got committed in another/same session, cannot update row (Oracle SQL Developer)

oracleoracle-sqldeveloper

提问by MaVRoSCy

I occasionally get this error when i try to update a record through the grid.

当我尝试通过网格更新记录时,偶尔会出现此错误。

One error saving changes to table "SCHEMA"."TABLENAME":
Row 3: Data got committed in another/same session, cannot update row.

Looked up at OTN but no solution yet given.

查了一下 OTN,但还没有给出解决方案。

Tried to disable the option Post edits on row changebut still no luck.

试图禁用在行更改时发布编辑选项,但仍然没有运气。

There is a known solution for setting the field to NULLthrough the SQL Worksheet but it's surely a pain.

有一个通过 SQL 工作表将字段设置为NULL的已知解决方案,但这肯定是一种痛苦。

回答by David Aldridge

It could be that your table is created with NOROWDEPENDENCIES so row-level dependency tracking is turned off, and SQL Developer is configured to "Use ORA_ROWSCN for DataEditor insert and update statements".

可能是因为您的表是使用 NOROWDEPENDENCIES 创建的,因此行级依赖项跟踪被关闭,并且 SQL Developer 被配置为“对 DataEditor 插入和更新语句使用 ORA_ROWSCN”。

Either uncheck the ORA_ROWSCN option, or recreate the table with ROWDEPENDENCIES.

要么取消选中 ORA_ROWSCN 选项,要么使用 ROWDEPENDENCIES 重新创建表。

回答by Hari Shankar Maurya

Just simply run simple update command and set your cplumn to null. Then try to update with your real value. It will definitely work.

只需简单地运行简单的更新命令并将您的 cplumn 设置为 null。然后尝试更新您的真实价值。它肯定会起作用。

回答by Helder Daniel

"One error saving changes to table "SCHEMA"."TABLENAME": Row XX: Data got committed in another/same session, cannot update row."

“保存对表“SCHEMA”的更改时出错。“TABLENAME”:第 XX 行:数据已在另一个/同一会话中提交,无法更新行。”

Got this error with SQL developer when commiting changes in multiple rows, but not when commiting a single row.

SQL 开发人员在提交多行更改时出现此错误,但在提交单行时没有。

I fixed going to:

我固定去:

Tools menu -> Preferences -> Database -> ObjectViewer

工具菜单 -> 首选项 -> 数据库 -> ObjectViewer

and check: "Post edits on row change"

并检查:“在行更改时发布编辑”

However, every time I navigate to another row takes some time (less than a second with the DB I am working on). For what I could understand from other posts the remote DB in my session is being updated (but not comitted to all sessions) every time I change row. However to commit to all session it is needed to explicitly commit.

但是,每次导航到另一行都需要一些时间(对于我正在处理的数据库不到一秒钟)。对于我从其他帖子中可以理解的内容,每次更改行时,我的会话中的远程数据库都会更新(但不会提交到所有会话)。但是,要提交到所有会话,需要明确提交。

Meanwhile I tried, as others suggested, to:

与此同时,正如其他人所建议的那样,我尝试:

Tools menu -> Preferences -> Database -> ObjectViewer

工具菜单 -> 首选项 -> 数据库 -> ObjectViewer

uncheck "Use ORA_ROWSCN for DataEditor insert and update statements" option (and also leave uncheck: "Post edits on row change")

取消选中“将 ORA_ROWSCN 用于 DataEditor 插入和更新语句”选项(也不要选中:“在行更改时发布编辑”)

This also works, but it is faster. It guess that now the update is only local. Remote DB is not updated every time I navigate to another row. It is needed to commit to update remote DB, but now with no errors.

这也有效,但速度更快。它猜测现在更新只是本地的。每次导航到另一行时,远程数据库都不会更新。需要提交更新远程数据库,但现在没有错误。

I read that this solution does not worked for all. It worked in my case with:

我读到这个解决方案并不适用于所有人。在我的情况下,它适用于:

SQL developer Version: 17.4.1.054, Build 054.0712

SQL 开发人员版本:17.4.1.054,内部版本 054.0712

ODAC 12.2c Release 1 and Oracle Developer Tools for Visual Studio (12.2.0.1.0) (32-bit) (http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html)

ODAC 12.2c 第 1 版和适用于 Visual Studio 的 Oracle 开发人员工具 (12.2.0.1.0)(32 位)(http://www.oracle.com/technetwork/topics/dotnet/utilsoft-086879.html

Remote DB server version: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

远程数据库服务器版本:Oracle Database 11g Release 11.2.0.1.0 - 64bit Production

回答by John

I ran into this problem as well while running a stored procedure. My solution fell inline with the above answers. Before updating the row that I wanted to the value I wanted, I added an update line that first updated the column to null. The following line then updated the column to the value that I wanted. I did this in addition to unchecking the box for ORA_ROWSCN.

我在运行存储过程时也遇到了这个问题。我的解决方案符合上述答案。在将我想要的行更新为我想要的值之前,我添加了一个更新行,该行首先将列更新为空。然后下面一行将列更新为我想要的值。除了取消选中 ORA_ROWSCN 的框外,我还这样做了。

UPDATE TEST_LOCATION SET STATUS = NULL WHERE FULL_NAME = SITE_FULL_NAME;

更新 TEST_LOCATION SET STATUS = NULL WHERE FULL_NAME = SITE_FULL_NAME;

UPDATE TEST_LOCATION SET STATUS = CAST(STATUS_IN AS INTEGER) WHERE FULL_NAME = SITE_FULL_NAME;

更新 TEST_LOCATION SET STATUS = CAST(STATUS_IN AS INTEGER) WHERE FULL_NAME = SITE_FULL_NAME;