Why do I get an open transaction when just selecting from a database View?

前端 未结 6 1060
一个人的身影
一个人的身影 2021-01-02 11:17

If I execute a simple select statement in pl/sql developer against a database table, I get a standard set of results back as I would expect.

Recently, I pasted a que

6条回答
  •  梦毁少年i
    2021-01-02 11:59

    You absolutely cannot open a transaction strictly with a normal query. You may open one across a database link. The guy who posted a link to the doctors either deliberately or utterly carelessly left out the 2nd sentence.

    "A transaction in Oracle Database begins when the first executable SQL statement is encountered. An executable SQL statement is a SQL statement that generates calls to an instance, including DML and DDL statements."

    SELECT is neither a DML nor a DDL. It is also TRIVIAL to actually test this. I don't want to come off like a troll here, but its really annoying when people just throw out answers on a forum to try to get points and the answers are complete garbage.

    Read the rest of the doc and TEST IT FIRST.

    • login to a session
    • run a select
    • see if you have an open transaction by joining v$Session (for your session) to v$transaction.

    If a record comes back, you have a transaction. If not, you don't.

提交回复
热议问题