Stored Procedure Vs Function

What is the impact of using a stored proc or a function on the performance? Which has a better performance? Also, why is it not possible to use DML in the functions called from a select query?

Questions by priyanka_sharma

Showing Answers 1 - 15 of 15 Answers

Miguel

  • Nov 2nd, 2012
 

A function is a store procedure indeed, and you can use autonomous transactions to do some DML

  Was this answer useful?  Yes

kritika kulshrestha

  • Feb 19th, 2013
 

Implicit cursor is created automatically,opened automatically and closed automatically.it holds exactly one record. in case none or more than 1 record are retrieved, an exception is raised and that result into error or abnormal termination of program. whereas explicit cursor is created,opened and closed explicitly.it is created to hold 1 or more records.FETCH statement is used to retrieve the record.in order to check whether the fetch statement has retrieve the record, attribute %NotFound is used.

  Was this answer useful?  Yes

chandrasekhar thimmapathruni

  • Apr 15th, 2015
 

We can call a function in a select statement, but not a procedure.

  Was this answer useful?  Yes

Suchith Shivali

  • Apr 17th, 2015
 

1)In stored procedure you may or may not return value but in the function return is compulsory.

2)If you want to return more than one value go for Stored procedure.

3)Once SP or function is created, a SP is called by using another anonymizes plsql block(unit testing) but where as in the function it can be called by the select statement.

4)In SP inbuilt return is not there but in function inbuilt return parameter is there

  Was this answer useful?  Yes

Nupur

  • Apr 24th, 2015
 

Functions and procedures are both named blocks of statement . A function must return a value . Performance wise if you want the program to return a single value use a  function . You can use out parameter in a procedure. Performance otherwise will depend on what the program is meant to do. You can call a function in a select statement . 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions