What’s up Internet? I am Manish from RebellionRider.com. Today’s PL/SQL tutorial is about Blocks
in PL/SQL programs. So without further ado let’s get started
with the quick intro of PL/SQL language. PL/SQL stands for procedural language-standard
query language. It is a significant member of Oracle programming
tool set which is extensively used to code server side programming. Similar to SQL language PL/SQL is also a case-insensitive
programming language. Generally a program written in PL/SQL language
is divided into blocks. We can say blocks are basic programming units
in PL/SQL programming language. There are two types of blocks in PL/SQL
- Anonymous Block
- Named Block
Both type of PL/SQL blocks are further divided into 3 different sections which are
- The Declaration Section
- The Execution Section and
- The Exception-handling Section
The Execution Section is the only mandatory section of block whereas Declaration and Exception
Handling sections are optional. And here is the basic prototypes of Anonymous
PL/SQL block DECLARE
Declaration Statements BEGIN
Executable statements Exception
Exception handling statements END;
Let’s quickly discuss each of these sections in brief. You can visit my blog for detailed explanation
and examples. The link is in the description box below. Declaration Section
This is the first section of PL/SQL block which contains definition of PL/SQL identifiers
such as variables, Constants, cursors and so on. You can say this is the place where all local
variables used in the program are defined and documented. Also Declaration sections always start with
keyword DECLARE. Execution Section
This section contains executable statements that allow you to manipulate the variables
that have been declared in the declaration section. The execution Section of any PL/SQL block
always begins with the Keyword BEGIN and ends with the Keyword END. This is the only mandatory section in PL/SQL
block. This section supports all DML commands and
SQL*PLUS built-in functions. It also supports DDL commands using Native
Dynamic SQL (NDS) or DMBS_SQL built-in package. Exception-Handling Section
This is the last section of PL/SQL block which is optional just like the declaration section. This section contains statements that are
executed when a runtime error occurs within the block. We can say all exception handling code goes
here. You can visit my blog where I have explained
this tutorial in more detail covering all the parts which will help you face Interview
questions or Oracle Certification exam. Link is in the description box. With this I will wind up today’s tutorial. Please like this video & also share it with
your friends and don’t forget to subscribe. You can also follow me on twitter and Instagram. The links are on your screen. Will see you soon with another tutorial till
then take care this is Manish from RebellionRider