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
Defining and Declaring Collections To create the collections, you must define a collection type, and then declare the collections of that type. You can define the VARRAY types a

Using Operator DEREF: You cannot navigate through refs within the PL/SQL procedural statements. Rather than, you should use the operator DEREF in the SQL statement. The DEREF

Magento change address format depending on store Project Description: What I need is that depending on the store in which the customer bought the address should change the fo

Loop Labels Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP

Name Resolution In potentially uncertain SQL statements, the names of the database columns take precedence over the names of the local variables and formal parameters. For e.g.

Introduction Oracle 9i - it was made public in the year 2001 with over 400 features, and graphics, it has merged the traditional business with modern internet application

LAWS / RULES - Dollo's Law                     :           Living organisms do exhibit evolutionary irreversibility or evolution is irreversible. Williston's Law

Procedures   The procedure is a subprogram which performs a specific action. You write procedures using the syntax as shown below: PROCEDURE name [(parameter[, parameter, .

Some Varray Examples In SQL Plus, assume that you define an object type Project, as described below: SQL> CREATE TYPE Project AS OBJECT ( 2 project_no NUMBER(2), 3 title VARCHA

Problem: (a) Define the following terms: (i) data mining. (ii) OLAP. (b) Differentiate between snowflake schema and star schema. Support your answer with appropriate