Object Name Resolution (248)

Object names referenced in SQL statements can consist of several pieces, separated by
periods. The following describes how Oracle resolves an object name.
1. Oracle attempts to qualify the first piece of the name referenced in the SQL
statement. For example, in hr.employees, hr is the first piece. If there is only one
piece, then the one piece is considered the first piece.
a. In the current schema, Oracle searches for an object whose name matches the
first piece of the object name. If it does not find such an object, then it
continues with step b.
b. Oracle searches for a public synonym that matches the first piece of the name.
If it does not find one, then it continues with step c.
c. Oracle searches for a schema whose name matches the first piece of the object
name. If it finds one, then it returns to step b, now using the second piece of
the name as the object to find in the qualified schema. If the second piece does
not correspond to an object in the previously qualified schema or there is not a
second piece, then Oracle returns an error.
If no schema is found in step c, then the object cannot be qualified and Oracle
returns an error.

2. A schema object has been qualified. Any remaining pieces of the name must match
a valid part of the found object. For example, if hr.employees.department_id
is the name, then hr is qualified as a schema, employees is qualified as a table,
and department_id must correspond to a column (because employees is a
table). If employees is qualified as a package, then department_id must
correspond to a public constant, variable, procedure, or function of that package.

Because of how Oracle resolves references, it is possible for an object to depend on the
nonexistence of other objects. This situation occurs when the dependent object uses a
reference that would be interpreted differently were another object present.

解析对象名称
1. 在 SQL 语句中引用的方案对象名称可由多段组成,各段之间使用“.”分隔
a. 在当前方案中搜索名称与对象名首段相符的对象 , 不存在进入步骤b
b. 搜索名称与对象名称首段相符的公有同义词 , 不存在进入步骤c
c. Oracle 搜索名称与对象名称首段相符的方案。如果找到一个这样的方案,则返回步骤 b,使用对象名称的第二段
在方案中搜索相符的对象。如果方案中不存在相符的对象,或者引用的对象名称只由一段构成,则 Oracle 将返回一个错误
如果在步骤 c 中没有找到相符的方案,那么引用的对象名称也不能被验证,Oracle 将返回一个错误

[@more@]
请使用浏览器的分享功能分享到微信等