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

前端 未结 6 1058
一个人的身影
一个人的身影 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条回答
  •  难免孤独
    2021-01-02 11:43

    Any SQL Statement starts a transaction in Oracle.

    From the manual:

    A transaction begins with the first executable SQL statement. A transaction ends when it is committed or rolled back, either explicitly with a COMMIT or ROLLBACK statement or implicitly when a DDL statement is issued. [...] An executable SQL statement is a SQL statement that generates calls to an instance, including DML and DDL statements

    Most probably those who are not seing this are running in auto-commit mode where the transaction started by a statement is immediately committed after the statement has finished.

    Others have claimed that a SELECT is not DML, but again the manual clearly states:

    Data manipulation language (DML) statements query or manipulate data in existing schema objects. They enable you to:

       * Retrieve or fetch data from one or more tables or views (SELECT)
       * Add new rows of data into a table or view (INSERT)
    [...]

提交回复
热议问题