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
How Bulk Binds Improve Performance The assigning of values to the PL/SQL variables in SQL statements is known as binding. The binding of the whole collection at once is know

UNION ALL - SQL Further varieties of UNION arise when we replace the key word DISTINCT by ALL in any of the foregoing examples, as in Example. ALL specifies that if row r appe

Project Description: I am looking to change FullCalendar to add/delete sql server data when events are removed or dropped from Calendar. Events should only be included by dra

Rephrase Conditional Control Statements When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops evaluating the expression as s

Use Object Types and Collections The Collection types and object types increase your efficiency by allowing for the realistic data modeling. The Complex real-world entities an

heap sort program in pl/sql

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

Operators on Tables and Rows Row Extraction TUPLE FROM r, SQL has row subqueries. These are just like scalar subqueries except that they may specify more than one column.

Natural Join - SQL In the absence of NATURAL JOIN Example has to be replaced by something rather more longwinded, as shown in Example. Example: Joining IS_CALLED and IS_EN

Mixed Notation The fourth procedure call shows that you can mix the positional and named notation. In this situation, the first parameter uses the positional notation, & the s