Name resolution - pl/sql, PL-SQL Programming

Assignment Help:

Name Resolution 

During the compilation, the PL/SQL compiler relates identifiers like the name of a variable with an address or memory location, actual value, or datatype. This process is termed as the binding. The relationship lasts through all the successive executions until the recompilation occurs, which may cause the rebinding.

Before binding the names, the PL/SQL should solve all the references to them in the compilation unit. This process is known as the name resolution. The PL/SQL considers all the names to be in the same namespace. Therefore, one declaration or definition in an inner scope can hide the other in an outer scope. In the illustration below, the declaration of the variable client hides the definition of the datatype Client as the PL/SQL is not case sensitive apart from within the string literals:

BEGIN

<>

DECLARE

TYPE Client IS RECORD (...);

TYPE Customer IS RECORD (...);

BEGIN

DECLARE

client Customer; -- hides definition of type Client

-- in outer scope

lead1 Client; -- illegal; Client resolves to the

-- variable client

lead2 block1.Client; -- OK; refers to type Client

BEGIN

NULL;

END;

END;

END;

Though, you can still refer to the datatype Client by qualifying the reference with the block label block1.

In the CREATE TYPE person1 statement below, the compiler solves the second reference to the manager as the name of the attribute you are trying to declare. In the CREATE TYPE person2 declaration, the compiler solves the second reference to the manager as the name of the attribute you merely declared. In both the situation, the reference to the manager generates an error as the compiler expects a type name.

CREATE TYPE manager AS OBJECT (dept NUMBER);

CREATE TYPE person1 AS OBJECT (manager manager);

CREATE TYPE person2 AS OBJECT (manager NUMBER, mgr manager);


Related Discussions:- Name resolution - pl/sql

Character types in pl/sql, Character Types The Character types allow yo...

Character Types The Character types allow you to store alphanumeric data, represent words and text, and manipulate the character strings. CHAR You use the CHAR dataty

Using exists - collection methods, Using EXISTS The EXISTS(n) returns ...

Using EXISTS The EXISTS(n) returns TRUE if the nth element in a collection exist. Or else, EXISTS(n) returns FALSE. Primarily, you use EXISTS with DELETE to maintain the spars

Parameter and keyword description - open-for statement, Parameter and Keywo...

Parameter and Keyword Description: cursor_variable_name: This identifies a cursor variable or the parameter formerly declared within the present scope. host_cursor_va

Effects of null for table expression, Effects of NULL for Table Expression ...

Effects of NULL for Table Expression Here's an important distinction between expressions denoting tables and expressions denoting multisets of rows: a table expression cannot

Is null operator-comparison operators, IS NULL Operator The IS NULL oper...

IS NULL Operator The IS NULL operator returns the Boolean value TRUE whenever its operand is null or FALSE if it is not null. The comparisons including the nulls always yield NU

%isopen - implicit cursor attributes, %ISOPEN The Oracle closes the SQ...

%ISOPEN The Oracle closes the SQL cursor automatically after executing its related SQL statement. As a result, the %ISOPEN forever yields FALSE.

Using limit - collection method, Using LIMIT For nested tables, that h...

Using LIMIT For nested tables, that have no maximum size, the LIMIT returns NULL. For varrays, the LIMIT returns the maximum number of elements that a varray can have (that yo

Loop statements, LOOP Statements The LOOP statements execute a series o...

LOOP Statements The LOOP statements execute a series of statements at multiple times. The loops enclose the series of statements that is to be repeated. The PL/SQL provides typ

%rowcount - implicit cursor attributes, %ROWCOUNT The %ROWCOUNT yields...

%ROWCOUNT The %ROWCOUNT yields the number of rows affected by the INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement. The %ROWCOUNT yields zero when a

Advantages of invoker rights, Advantages of Invoker Rights The Invoker-...

Advantages of Invoker Rights The Invoker-rights routines centralize the data retrieval. They are particularly helpful in applications which store data in various schemas. In su

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd