01-02-2013, 03:24 PM
HIGH LEVEL PROGRAMMING LANGUAGE EXTENSIONS
Aim:
To implement PL/SQL program using control structures, procedures and functions.
CONTROL STRUCTURES:
Introduction:
An interactive control statement is used when we want to repeat the execution of one or more statements for specified number of times.
If-then:
The simplest way of IF statement associates a condition with a sequence of statements enclosed by the keywords THEN and END IF.
With each iteration of the loop, the sequence of the statements is executed then the control resumes at the top of the loop. If further processing is undesirable or impossibly you can use an EXIT statement to complete the loop.
Exit:
The EXIT statement forces a loop to complete unconditionally. When an EXIT statement is encountered the loop completes immediately and control passes to the next statement.
For loop:
The number of iterations through FOR loop is known before the loop is entered. FOR loops iterate over a specified range of integers, the range is part of an iteration scheme, which is enclosed by the keywords FOR and LOOP. A double dot (..) serves as the range operator.
NULL statement:
The null statement does nothing other than pass control to the next statement. In a conditional construct the NULL statement tells readers that a possibility has been considered, but no action is necessary.
PROCEDURES:
The procedure is a program that performs an action and does not return a value. A procedure has two parts: the specification and the body. The procedure spec begins with the keyword PROCEDURE and ends with the procedure name or a parameter list. Parameter declarations are optional. Procedures that take no parameters are written without parentheses.
The procedure body begins with the keyword IS (or AS) and ends with the keyword END followed by an optimal procedure name. The procedure body has three parts: a declarative part, an executable part, and an optional exception-handling part.
The declarative part contains local declarations, which are placed between the keywords IS and BEGINS. The keyword DECLARES, which introduces declarations in an anonymous PL/SQL block, is not used. The executable part contains statements, which are placed between the keywords BEGIN, and EXCEPTION (or END).
RESULT:
Thus the procedures and functions were studied and executed in PL/SQL.