In this PL/SQL Tutorial, We will explore about the block structure in Oracle PL/SQL.
As we known that PL/SQL is a Block Structure Language because in the PL/SQL , we can write multiples block of code or we can arrange multiple code into different groups of element.
Before the start let's understand about the block, In the PL/SQL, Block is piece of code or some unit of code.
Blocks are divided into two different category.
- Anonymous Block
- Named Block
Anonymous Block:-
- Which block is not given any name is called Anonymous Block.
- Anonymous block has been defined into three part declaration,execution and exception handling section.
- Execution Section is necessary where declaration and exception handling section is optional.
- It is not save as a database object.
DECLARE (declaration section) ---OPTIONAL--- BEGIN (execution section)---MANDATORY--- EXCEPTION (exception handling)--OPTIONAL-- END;
We will discuss in the details about the Anonymous block in our next PL/SQL Tutorial.
Named Block:-
- Which block is given any name is called Named Block. It is different from the anonymous block.
- In the Named Block, Header Section is added instead of declare keyword.
- Header Section define the which types of Named Block we are creating. Procedure and Function are the example of Named Block.
- Named Block is save as a database object.
- Named block is also example of reusability. Named block create once and runs multiple times.
HEADER-------MANDORARY--- IS/AS (DECLARATION SECTION) ---OPTIONAL--- BEGIN (EXECUTION SECTION)---MANDORARY--- EXCEPTION (EXCEPTION HANDLING)OPTIONAL END;
We will discuss in the details about the Named block in our next PL/SQL Tutorial.
That's all for today, Maybe this What is PL/SQL block structure in Oracle blog post will helps you. If you like this post then share your valuable comment or view.
0 Comments
If you have any doubts, Please let me know