使用 OCCI 删除永远运行

When using OCCI deleting runs forever

同一行:

DELETE(SELECT * FROM tablename WHERE id=12)

on SQL 开发人员运行正常,使用 occi 时 API 需要永远。

我已检查查询 "SELECT * FROM tablename WHERE id=12" 匹配非空行集。

更具体地说,我使用以下语法:

oracle::occi::Statement *deleteStm = con->createStatement("DELETE(SELECT * FROM tablename WHERE id=12)");
oracle::occi::ResultSet *rs = deleteStm->executeQuery();

我怀疑在你的情况下你只是有未提交的交易。它是这样的:

session1                   session2
DELETE ...                                        table/rows is locked

                           SELECT * FROM ...      you will see all data

                           DELETE ...             and now you will wait and wait
                                                  until lock is released

COMMIT;
                           SELECT * FROM ...      now resultset is empty

我强烈建议阅读Data Concurrency and Consistency