Docsity

Oracle PLSQL difference between procedure and function, Assignments of Database Programming

Toggle sidebar
bg1
What is difference between procedure and function with
Examples?
In my previous article I have given the details about theprocedures andhow to
execute the parameterized procedures in detail.In this article I would like to
throw light on what are user defined functions in PL/SQL and the key interview
question asked in PL/SQL interviews i.e. the difference between stored
procedures and functions with examples. The procedures and functions are
basic building blocks of PL SQL. There is always a question in interview about
difference between procedure and function with examples.
This article contains :
1. What are functions in PL/SQL with example?
2. What are procedures in PL/SQL with example?
3. Difference between procedure and function with example.
What are PLSQL functions with example?
The PL SQL functions are nothing but the named PL/SQL blocks which will used
to return the specified value. The functions always returns the value.
There are two types of PL SQL functions :
1. In Built functions : These are built in functions by Oracle SQL or PL SQL
engine.
2. User Defined Functions : These are basic building blocks which will return
the value created by developers.
pf3
pf4

Partial preview of the text

Download Oracle PLSQL difference between procedure and function and more Assignments Database Programming in PDF only on Docsity!

What is difference between procedure and function with

Examples?

In my previous article I have given the details about the procedures and how to execute the parameterized procedures in detail. In this article I would like to throw light on what are user defined functions in PL/SQL and the key interview question asked in PL/SQL interviews i.e. the difference between stored procedures and functions with examples. The procedures and functions are basic building blocks of PL SQL. There is always a question in interview about difference between procedure and function with examples. This article contains :

  1. What are functions in PL/SQL with example?
  2. What are procedures in PL/SQL with example?
  3. Difference between procedure and function with example.

What are PLSQL functions with example?

The PL SQL functions are nothing but the named PL/SQL blocks which will used to return the specified value. The functions always returns the value. There are two types of PL SQL functions :

  1. In Built functions : These are built in functions by Oracle SQL or PL SQL engine.
  2. User Defined Functions : These are basic building blocks which will return the value created by developers.

Functions in PL SQL The functions are stored in the Schema as database objects. You can call the function as expression or it is used to provide the parameter value. Syntax : Create function function_name is as Variable declaration Begin Business logic Return statement;

where employee_id=P_EMP_ID; commit; exception WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE (SQLCODE); DBMS_OUTPUT.PUT_LINE (SQLERRM); END; end;

What are procedures with real life example?

I have already given the details about the procedure and execution of the procedure. In this section I just want to throw light on what is mean by procedure. The PL/SQL procedure is basic building block which is used to perform any action. Just like a function it also can be stored as database object named procedure. The key features of procedure is reusability and maintainability. There are three types of parameters which you can use to call the procedures in PLSQL i.e. IN,OUT,INOUT You can execute procedure in anonymous block or using exec keyword.

What is difference between procedure and

function :

Difference between procedure and function These are few difference between procedures and function in PL SQL. I hope you get clear idea about difference between Procedure and function in PL SQL with real examples. If you like this article or if you have any concerns with the same kindly comment in comments section.