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

PRO+

Content

Find more PRO+ content and other member only offers, here.

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.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close