I would like to know about difference between stored procedure and function in oracle.As a fresher to oracle,can you all help me to know the differences?
-
You should have googled first, my friend.Raging Bull– Raging Bull2015-07-29 10:55:14 +00:00Commented Jul 29, 2015 at 10:55
-
1The documentation is very helpful for this sort of thing. Also see the second paragraph at the top of that page: "Typically, you use a procedure to perform an action and a function to compute and return a value", which is common practice, though not enforced.Alex Poole– Alex Poole2015-07-29 10:57:28 +00:00Commented Jul 29, 2015 at 10:57
Add a comment
|
1 Answer
A function generally returns a single value in Oracle (be it a scalar value, or a single defined object/data-table). A procedure on the other hand can return any number of outputs and does not need to actually have any inputs OR any outputs.
If you need to do JOIN-like behaviour then you'll need to use a function to apply the function against individual rows with varying input. Oracle functions are semantically more graceful than functions - but are harder to optimise and see inside of sometimes.