
These items are local to the subprogram and cease to exist when the subprogram completes execution. It contains declarations of types, cursors, constants, variables, exceptions, and nested subprograms. However, the declarative part for a subprogram does not start with the DECLARE keyword. Like anonymous PL/SQL blocks, the named blocks will also have the following three parts − S.No Parts of a PL/SQL SubprogramĮach PL/SQL subprogram has a name, and may also have a parameter list.

We will discuss PL/SQL function in the next chapter. This chapter is going to cover important aspects of a PL/SQL procedure. Procedures − These subprograms do not return a value directly mainly used to perform an action. PL/SQL provides two kinds of subprograms −įunctions − These subprograms return a single value mainly used to compute and return a value. PL/SQL subprograms are named PL/SQL blocks that can be invoked with a set of parameters. We will discuss packages in the chapter 'PL/SQL - Packages'. It is stored in the database and can be deleted only when the package is deleted with the DROP PACKAGE statement. It is stored in the database and can be deleted with the DROP PROCEDURE or DROP FUNCTION statement.Ī subprogram created inside a package is a packaged subprogram. It is created with the CREATE PROCEDURE or the CREATE FUNCTION statement. A subprogram can be invoked by another subprogram or program which is called the calling program.Īt the schema level, subprogram is a standalone subprogram. This is basically called the 'Modular design'. These subprograms are combined to form larger programs. A subprogram is a program unit/module that performs a particular task.

In this chapter, we will discuss Procedures in PL/SQL.
