Stored procedure & Functions

Started by mark.smith836, September 06, 2012, 03:27:07 AM

mark.smith836

My friend did brief me on the major difference between functions and stored procedure but I still have no idea about it and I request detailed information with regard to this and appreciate your assistance .
Spinx Inc. – A Well-known and an Ideal Company for Mobile Applications Development Service
http://mobile-development.spinxwebdesign.com/

kathrine01

Stored Procedure:-

A Stored Procedure is a program (or procedure) which is physically stored within a database. They are usually written in a proprietary database language like PL/SQL for Oracle database or PL/PgSQL for PostgreSQL. The advantage of a stored procedure is that when it is run, in response to a user request, it is run directly by the database engine, which usually runs on a separate database server. As such, it has direct access to the data it needs to manipulate and only needs to send its results back to the user, doing away with the overhead of communicating large amounts of data back and forth.

User-defined Function:-

A user-defined function is a routine that encapsulates useful logic for use in other queries. While views are limited to a single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.

User defined functions have three main categories:

Scalar-valued function - returns a scalar value such as an integer or a timestamp. Can be used as column name in queries.
Inline function - can contain a single SELECT statement.
Table-valued function - can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.

cursor system

Store procedure is used mostly in database management structure to pass values to database fro user while function only eccept values from user and return single result
Know more about Best Price Electronic Item here

ruby

Quote from: kathrine01 on September 14, 2012, 07:40:31 AM
Stored Procedure:-

A Stored Procedure is a program (or procedure) which is physically stored within a database. They are usually written in a proprietary database language like PL/SQL for Oracle database or PL/PgSQL for PostgreSQL. The advantage of a stored procedure is that when it is run, in response to a user request, it is run directly by the database engine, which usually runs on a separate database server. As such, it has direct access to the data it needs to manipulate and only needs to send its results back to the user, doing away with the overhead of communicating large amounts of data back and forth.

User-defined Function:-

A user-defined function is a routine that encapsulates useful logic for use in other queries. While views are limited to a single SELECT statement, user-defined functions can have multiple SELECT statements and provide more powerful logic than is possible with views.

User defined functions have three main categories:

Scalar-valued function - returns a scalar value such as an integer or a timestamp. Can be used as column name in queries.
Inline function - can contain a single SELECT statement.
Table-valued function - can contain any number of statements that populate the table variable to be returned. They become handy when you need to return a set of rows, but you can't enclose the logic for getting this rowset in a single SELECT statement.
Absolutely brilliant! I like your descriptive style. Looking forward to reading more such stuff. Thanks for updating.