Initializing objects in pl sql, PL-SQL Programming

Assignment Help:

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


Related Discussions:- Initializing objects in pl sql

Enrolment was split - sql, Enrolment was split - SQL Example shows ho...

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

When are constraints checked - sql, When Are Constraints Checked Unde...

When Are Constraints Checked Under the model constraints are conceptually checked at all statement boundaries (and only at statement boundaries). By default the same is true

Using savepoints, Using Savepoints The scope of the savepoint is a tra...

Using Savepoints The scope of the savepoint is a transaction in which it is defined. The Savepoints defined in the major transaction are not related to the savepoints defined

Select into statement - syntax, SELECT INTO Statement   The SELECT INT...

SELECT INTO Statement   The SELECT INTO statement retrieve data from one or more database tables, and then assigns the selected values to the variables or fields. Syntax:

Ensuring backward compatibility, Ensuring Backward Compatibility   The...

Ensuring Backward Compatibility   The PL/SQL Version 2 permits some abnormal behavior which Version 8 disallows. Particularly, Version 2 permits you to (i) Make the forw

Updating variables, Updating Variables For assignment, SQL uses the ke...

Updating Variables For assignment, SQL uses the key word SET, as in SET X = X + 1 (read as "set X equal to X+1") rather than X: = X + 1 as found in many computer languages.

Differentiate between snowflake schema and star schema, Problem: (a) De...

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

Create a procedure to tax calculation task, Complete the following steps to...

Complete the following steps to create a procedure to calculate the tax on an order. The BB_TAX table contains the states that require taxes to be submitted for Internet sales. If

How transactions guard your database, How Transactions Guard Your Database ...

How Transactions Guard Your Database The transaction is a sequence of SQL data manipulation statements which does a logical unit of work. The Oracle treats the sequence of SQL

Goto statement - syntax, GOTO Statement   The GOTO statement branches ...

GOTO Statement   The GOTO statement branches categorically to a block label or statement label. The label should be exclusive within its scope and should precede a PL/SQL bloc

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