null statementthe null statement clearly


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;

Request for Solution File

Ask an Expert for Answer!!
PL-SQL Programming: null statementthe null statement clearly
Reference No:- TGS0172539

Expected delivery within 24 Hours