Tuesday, November 18, 2008

difference between function and procedure

Q. What is the difference between function and procedure?

Ans: - A procedure or function is a logically set of SQL and PL/SQL statement that perform a specific task. A function must return a value back to the caller. A function can return only one variable to the calling PL/SQL code block whereas in case of procedure multiple values can be return to the caller by defining multiple OUT parameters.

 

But in normal way a function is a portion of code within a larger program which serves a single purpose. For example, we could write a function to find the factorial of a number. Then, any time in our code when we want to calculate the factorial of a number we could use that function instead of writing that code over again each time.

A procedure is some finite steps to perform a task in some specific order.

 

1 comment:

rakhi said...

a very good step. thats very helpful for the student to prepare for placement. GOOD JOB.