Q
Problem solve Get help with specific problems with your technologies, process and projects.

When to use functions and stored procedures

Both stored procedures and functions can return something. Is there any guideline as to when I should use a procedure...

instead of a function? For example, for returning cursors, what's the advantage of using one over another?

I use functions to return computed values. I can call a function in a SELECT list (for example: SELECT my_function() FROM dual ;) as well as in PL/SQL.

I use procedures to return cursors or to do any type of procedural processing (step by step) where I don't necessarily care about returning a value, only that the steps happen successfully or not.

For More Information


This was last published in June 2003

Dig Deeper on Oracle stored procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close