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
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

Advantages of Packages The benefits of the Packages are as shown below: Modularity The Packages encapsulate logically associated items, types, and subprograms in the

Transaction Control The Oracle is transaction oriented; that is, Oracle uses the transactions to make sure the data integrity. The transaction is a sequence of SQL data manip

Write a stored procedure that accepts the post code in which the customer resides as the input parameter. The procedure should then use an explicit cursor to display comprehensive

EXIT The EXIT statement forces a loop to done unconditionally. Whenever an EXIT statement is encountered, the loop is done immediately and controls the passes to the next statem

Many of the reports generated from the system calculate the total dollars in a shopper''s purchases. Follow these steps to create a function named TOT_PURCH_SF that accepts a shopp

OPEN-FOR Statement The OPEN-FOR statements execute the multi-row query related with a cursor variable. It also allocates the resources used by the Oracle to process the query a

Effects of NULL for UNIQUE Specification When a UNIQUE specification u for base table t includes a column c that is not subject to a NOT NULL constraint, the appearance of sev

#quesWrite a cursor to open an employee database and fetch the employee record whose age is greater than 45.tion..

I want to implement heap sort algorithm in pl sql please share the source code for guidance