How to choose between a procedure and a function?

Showing Answers 1 - 14 of 14 Answers

DIPALI RINAYAT

  • Sep 22nd, 2006
 

function returns value but procedure not.

 

  Was this answer useful?  Yes

1.function invoke as a part of an expression. Procedure executes as a plsql statement

2. function must contain return clause in hedder. Procedure donot contain return clause in hedder

3. function must return a single value. Procedure can return none,one or multiple values

Mohammed Irfan

  • Oct 10th, 2006
 

if you are performing an operation which does not require to return any value,

or wants to return multiple values go for procedures,

if ur confident that ur operation will return only one value then go for functions

and remember to have function & procedure name very cohesive with the operations they perform.

  Was this answer useful?  Yes

cc

  • Nov 2nd, 2006
 

If want 2 calculate something and not interested in return value

then Use Procedure otherwise F(x)

  Was this answer useful?  Yes

Debi Prasad Maharana,Wipro Technologies.

  • Nov 20th, 2006
 

hi,when to select function :(1) when you want your program unit to return some value.(2) when you want your program unit to be a part of pl/sql expression(3) when you want your program unit to be called in the SQL statement. ( using the function in SQL statement there are some restrictions are there , if you have any doubt regarding this please get back to me.)when to select procedure :(1) when you want your program unit to execute some business logic .(2) when you don't want any return statement from your program unit.

  Was this answer useful?  Yes

Manish

  • Nov 23rd, 2006
 

1. SP can not return the table datatype whereas function can return.

2. in UDFunction if one sql statement raise the error then whole function is terminated where in SP if one sql statement raise the error then other sql statement can be executed.

  Was this answer useful?  Yes

sharib

  • Jan 11th, 2007
 

i think you are wrong.we can write dml in both function and procedure.

  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