Initializing objects in pl sql, PL-SQL Programming

Initializing Objects:

Till you initialize an object by calling the constructor for its object type, the object is automatically null. That is, the object itself is null, not merely its attributes. Consider the

Illustration which is as shown:

DECLARE

r Rational; -- r become atomically null

BEGIN

r := Rational(2,3); -- r becomes 2/3

The null object is never equal to the other object. However, comparing a null object with any other object always results NULL. Also, if you assign an atomically null object to the other object, the other object becomes atomically null. Similarly, if you assign the non-value NULL to an object, the object becomes automatically null, as the illustration below shows:

DECLARE

r Rational;

BEGIN

r Rational := Rational(1,2); -- r becomes 1/2

r := NULL; -- r becomes atomically null

IF r IS NULL THEN ... -- condition yields TRUE

 

A good quality programming practice is to initialize an object in its declaration, as shown in the illustration shown below:

 

DECLARE

r Rational := Rational(2,3); -- r becomes 2/3

Posted Date: 10/6/2012 8:13:14 AM | Location : United States







Related Discussions:- Initializing objects in pl sql, Assignment Help, Ask Question on Initializing objects in pl sql, Get Answer, Expert's Help, Initializing objects in pl sql Discussions

Write discussion on Initializing objects in pl sql
Your posts are moderated
Related Questions
THEO R Y OF SPECIAL CREATION - Life originated on the earth due to natural events by the super natural power. The biblical story of creation of world within six days was p

In Packages The Forward declarations also group logically related subprograms in the package. The subprogram specifications go in the package specification, & the subprogram b

Example of DELETE - SQL As with UPDATE, a FOR PORTION OF clause can be specified if the target table has a defined period name, as illustrated in Example. Example: Deleting

%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

Parameter and Keyword Description: type_name: This identifies a user-defined type specifier that is used in the subsequent declarations of the objects. AUTHID Clause:

Challenge 1 You are required to do the project and write a test plan for it. Demo 4 is a check writer program for employees. In it, the user enters all information about the

Product-specific Packages The Oracle and different Oracle tools are supplied with the product-specific packages which help you to build the PL/SQL-based applications. For illus

V ariables and Constants in PL/SQL The PL/SQL permits you to declare constants and variables, and then use them in SQL and procedural statements anywhere in the expression. Th

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

Enrolment was split - SQL Example shows how relvars IS_CALLED and IS_ENROLLED_ON can be derived from the original ENROLMENT relvar, using projection in the initial assignment