Resolution of Schema Object Dependencies (241)

tsinglee發表於2007-11-24

When a schema object is referenced directly in a SQL statement or indirectly through a
reference to a dependent object, Oracle checks the status of the object explicitly
specified in the SQL statement and any referenced objects, as necessary. Oracle’s action
depends on the status of the objects that are directly and indirectly referenced in a SQL
statement:
■ If every referenced object is valid, then Oracle runs the SQL statement
immediately without any additional work.
■ If any referenced view or PL/SQL program unit (procedure, function, or package)
is invalid, then Oracle automatically attempts to compile the object.
■ If all invalid referenced objects can be compiled successfully, then they are
compiled and Oracle runs the SQL statement.
■ If an invalid object cannot be compiled successfully, then it remains invalid.
Oracle returns an error and rolls back the failing SQL statement. The rest of the
transaction is unaltered and can be committed or rolled back by the user.

Note: Oracle attempts to recompile an invalid object dynamically
only if it has not been replaced since it was detected as invalid. This
optimization eliminates unnecessary recompilations.

解析方案物件的依賴性
1. 如果所有的引用物件均處於有效狀態,則 Oracle直接執行 SQL 語句
2. 如果 SQL 語句中存在無效的引用檢視或 PL/SQL 程式結構,Oracle 將自動地嘗試編譯這些物件
如果編譯成功 , 執行SQL 語句
如果有任何一個引用物件編譯不成功,則繼續保持無效狀態 ,Oracle 回滾執行失敗的 SQL 語句並返回一個錯誤資訊

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-983757/,如需轉載,請註明出處,否則將追究法律責任。

相關文章