Null statement-sequential control, PL-SQL Programming

NULL Statement

The NULL statement clearly specifies in action; it does nothing other than to pass control to the next statement. It can, though, improve the readability. In a construct allowing the substitute actions, the NULL statements serve as a placeholder. It tells the readers that the related alternative has not been overlooked, but required that no action is necessary. In the following illustration, the NULL statement shows that no action is taken for the unnamed exceptions:


EXCEPTION
WHEN ZERO_DIVIDE THEN
ROLLBACK;
WHEN VALUE_ERROR THEN
INSERT INTO errors VALUES...
COMMIT;
WHEN OTHERS THEN
NULL;
END;


Each of the clause in an IF statement should contain at least one executable statement. The
NULL statement is executable; therefore you can use it in clauses that correspond to the circumstances in which no action is taken. In the following illustration, the NULL statements emphasize that only top-rated employees get bonus:


IF rating > 90 THEN
compute_bonus(emp_id);
ELSE
NULL;
END IF;


The NULL statement is also a handy way to create stubs when designing the applications from the top down. A stub is dummy subprogram that permits you to defer the definition of a procedure or function till you test and debug the main program. In the following illustration, the NULL statement meets the requirement that at least one statement should appear in the executable part of a subprogram:




PROCEDURE debit_account (acct_id INTEGER, amount REAL) IS
BEGIN
NULL;
END debit_account;

Posted Date: 10/3/2012 6:23:26 AM | Location : United States







Related Discussions:- Null statement-sequential control, Assignment Help, Ask Question on Null statement-sequential control, Get Answer, Expert's Help, Null statement-sequential control Discussions

Write discussion on Null statement-sequential control
Your posts are moderated
Related Questions
Multiset types - SQL An SQL multiset is what in mathematics is also known as a bag-something like a set except that the same element can appear more than once. The body of an

Data Types in SQL - Timestamp TIMESTAMP for values representing points in time on a specified uniform scale. DATE is used for timestamps on a scale of one day, such as DATE '2

"Not Enforced" Table Constraints A constraint that is not enforced is not really a constraint within the meaning of the act, but SQL does have such a concept and it needs to b

Records Records are the items of the type RECORD. The Records have exclusively named fields that can store the data values of various types. And hence, a record treat associate

Effects of NULL in Aggregate Operator - SQL Let aggop(x) be an invocation of some aggregate operator aggop in SQL, where x is an expression (usually an open expression) to be

Redeclaring Predefined Exceptions Keep in mind that, the PL/SQL declares predefined exceptions globally in the package STANDARD; Therefore you need not declare them yourself.

Grouping and Ungrouping in SQL Example specifying EXAM_MARK in place of COURSE in the main FROM clause. Example: Obtaining C_ER2 from EXAM_MARK SELECT CourseId, CAST

what is the use of declare keyword

Declaring Objects: You can use the object types wherever built-in types like CHAR or NUMBER can be used. In the block below, you can declare object r of type Rational. Then, yo

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,