Skip to content

DBMS/U3 Topic 9 PL/SQL: Functions

A function is same as a procedure except that it returns a value. Therefore, all the discussions of the previous chapter are true for functions too.

Creating a Function

A standalone function is created using the CREATE FUNCTION statement. The simplified syntax for the CREATE OR REPLACE PROCEDURE statement is as follows −


[(parameter_name [IN | OUT | IN OUT] type [, …])]

RETURN return_datatype

{IS | AS}


 < function_body >

END [function_name];


  • function-namespecifies the name of the function.
  • [OR REPLACE] option allows the modification of an existing function.
  • The optional parameter list contains name, mode and types of the parameters. IN represents the value that will be passed from outside and OUT represents the parameter that will be used to return a value outside of the procedure.
  • The function must contain a return
  • The RETURNclause specifies the data type you are going to return from the function.
  • function-bodycontains the executable part.
  • The AS keyword is used instead of the IS keyword for creating a standalone function.



1 Comment »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: