Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
50
Добавлен:
16.04.2013
Размер:
5.97 Mб
Скачать

Understanding Capture

--separated chain of identifiers,

--including schema name used as

--scope qualifier followed by package

--name used as scope qualifier

--followed by function name)

--followed by component selector

--of the returned result followed

--by indexing followed by component

--selector

n := scott.pkg1.f1.n;

--(10) dot-separated chain of identifiers

--(schema name used as scope qualifier

--followed by package name also used

--as scope qualifier followed by

--function name also used as scope

--qualifier followed by local

--variable name)

...

END f1;

FUNCTION f2 (q1 NUMBER) RETURN t2 IS BEGIN

...

END f2; END pkg1;

Differences in Name Resolution Between SQL and PL/SQL

When the PL/SQL compiler processes a SQL statement, such as a DML statement, it uses the same name-resolution rules as SQL. For example, for a name such as SCOTT.FOO, SQL matches objects in the SCOTT schema first, then packages, types, tables, and views in the current schema.

PL/SQL uses a different order to resolve names in PL/SQL statements such as assignments and procedure calls. In the case of a name SCOTT.FOO, PL/SQL searches first for packages, types, tables, and views named SCOTT in the current schema, then for objects in the SCOTT schema.

Understanding Capture

When a declaration or type definition in another scope prevents the compiler from resolving a reference correctly, that declaration or definition is said to "capture" the reference. Usually this is the result of migration or schema evolution. There are three kinds of capture: inner, same-scope, and outer. Inner and same-scope capture apply only in SQL scope.

Inner Capture

An inner capture occurs when a name in an inner scope no longer refers to an entity in an outer scope:

The name might now resolve to an entity in an inner scope.

The program might cause an error, if some part of the identifier is captured in an inner scope and the complete reference cannot be resolved.

If the reference points to a different but valid name, you might not know why the program is acting differently.

How PL/SQL Resolves Identifier Names D-3

Соседние файлы в папке Oracle 10g