-3

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 Jul 29 '15 at 10:55
  • 1
    [The documentation](http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/subprograms.htm#CIHGHIAE) 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 Jul 29 '15 at 10:57

1 Answers1

2

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.

Steve Gray
  • 450
  • 2
  • 4