Block structure in pl/sql, PL-SQL Programming

Block Structure

The PL/SQL is a block-structured language. That is, the fundamental units (procedures, anonymous blocks, and functions) that make up a PL/SQL program are logical blocks that can contain any number of nested sub-blocks. Usually, each logical block corresponds to a problem or sub problem to be solved. Hence, PL/SQL supports the divide-and-conquer approach to problem solving known as the stepwise refinement.

A block or sub-block, lets you group logically related to declarations and statements. That way, you can place the declarations close to where they are used. These declarations are local to the block and cease to be present when the block completes.

As the figure shows, a PL/SQL block has three sections: a declarative section, an executable section, and an exception-handling section. (In PL/SQL, a warning or error condition is termed as an exception.) Only the executable section is needed.

The order of the section is logical. First comes the declarative section, in which items can be declared. Once the items are declared, it can be manipulated in the executable section. The Exceptions raised during an execution can be dealt within the exception-handling section.

 

106_block structure.png

Figure: Block Structure

You can nest sub-blocks in the executable and exception-handling sections of a PL/SQL block or subprogram but not in the declarative part. You can also define local subprograms in the declarative section of any block. Though, you can call local subprograms only from the block in which they are defined.

Posted Date: 10/2/2012 1:12:27 AM | Location : United States







Related Discussions:- Block structure in pl/sql, Assignment Help, Ask Question on Block structure in pl/sql, Get Answer, Expert's Help, Block structure in pl/sql Discussions

Write discussion on Block structure in pl/sql
Your posts are moderated
Related Questions
Logical Operators The logical operators AND, NOT, and OR follow the tri-state logic shown in table below. The AND and OR are binary operators; NOT is a unary operator.

Updating Objects: To change the attributes of objects in an object table, you can use the UPDATE statement, as the illustration below shows: BEGIN UPDATE persons p SET p

Definition of CROSS JOIN - SQL Let s = t1 CROSS JOIN t2, where t1 and t2 are table expressions optionally accompanied by range variables. Then: Note: Here T denotes Table

Number Types The Number types permit you to store the numeric data (real numbers, integers, and floating-point numbers), show quantities, and do computations. BINARY_INTEG

Iterative Control: LOOP  Statements The LOOP statement executes a series of statements multiple times. There are 3 forms of LOOP statements: LOOP, WHILE-LOOP, & FOR-LOOP. LOOP

OUT Mode An OUT parameter returns values to the caller of a subprogram. Within the subprogram, an OUT parameter act like a variable. That means that you can use an OUT formal

COSMOZOI C THEORY - Richter (1865) proposed the cosmozoic theory that says that life came by spores (cosmozoa) or other particles from other planets on the earth.

Logical Connectives - SQL SQL's extended truth tables in which the symbol, for unknown, appears along with the usual T and F. Negation (NOT, ¬) Conjunction (

Using INNER JOIN INNER JOIN is used to retrieve the data from all tables listed based on a condition of equality listed after keyword ON. If the condition is not meet, rows ar

DELETE Statement The DELETE statement eliminates whole rows of data from the specified table or view. Syntax: