Name resolution - pl/sql, PL-SQL Programming

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);

Posted Date: 10/8/2012 8:15:00 AM | Location : United States







Related Discussions:- Name resolution - pl/sql, Assignment Help, Ask Question on Name resolution - pl/sql, Get Answer, Expert's Help, Name resolution - pl/sql Discussions

Write discussion on Name resolution - pl/sql
Your posts are moderated
Related Questions
Projection in SQL - correct version Student StudentId is enrolled on some course. SELECT DISTINCT StudentId FROM IS_ENROLLED_ON In more complicated examples it is someti

Example of GROUP BY and COLLECT Operator Example: Using GROUP BY and COLLECT to obtain C_ER2 SELECT CourseId, CAST ( COLLECT (ROW (StudentId, Mark)) AS ROW (Studen

Need to change mysql query to PDO Project Description: I want someone to convert me 1 .php file that includes some sql/mysql stuff to PDO is a very small file. Skills requ

SQL Operators The PL/SQL uses all the SQL set, comparison, and row operators in the SQL statements. This part briefly describes some of these operators.  1. Comparison Opera

Majority of Differences among 9i, 10G, 11G :- These are some combine feature which has differences among others. Automatic Workload Repository (AWR) Drop database' s

Updating by insertion Syntax : INSERT INTO ENROLMENT VALUES (SID ('S4'), 'Devinder', CID ('C1'));

Updating a Variable Assignment of an attribute value in a variable of a structured type Synatx: SET SN.C = 'S2'; As in Example the entire statement is equivalent to a

Write a stored procedure that accepts the post code in which the customer resides as the input parameter. The procedure should then use an explicit cursor to display comprehensive

Explicit Cursors The set of rows returned by the query can include zero, one, or multiple rows, depending on how many rows meet your search criteria. Whenever a query returns

WHEN or THEN Key Constraints Suppose a table has two columns representing a period of time throughout which the information conveyed by the other columns is recorded as having