RE: how to choose between a procedure and a function?
Both function and procedure returns value.function has explicit return statement.procedure returns multiple valueswithin the function body we cant put DML statements.
RE: how to choose between a procedure and a function?
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.
RE: how to choose between a procedure and a function?
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.