Re: Stored Procedures and Functions - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Stored Procedures and Functions
Date
Msg-id 162867790706020925w90942ebh9825bd45d480aa5c@mail.gmail.com
Whole thread Raw
In response to Stored Procedures and Functions  ("Harpreet Dhaliwal" <harpreet.dhaliwal01@gmail.com>)
List pgsql-general
Hello

>
> Is it true that postgres doesn't have a notion of Stored Procedures and
> functions is what it has instead?
> RDBMS like Sql Server supports both stored procedures and functions.
> So I was wondering what is the difference between a Stored Procedure and a
> function.
>

It's true. PostgreSQL knows only functions. Difference between
procedures and function are in calling context a possibilities, and
depends on database system. Functions are called from SELECT
statements, procedures are called via statement CALL. On some systems
functions has some limits (it's not true for PostgreSQL). On some
systems procedures allow transaction con troll, returning
multirecordset (unbind selects), and more.

PostgreSQL implementation is more practical than elegant. PostgreSQL
functions hasn't classic limits, but some design points are little bit
dirty. When you start to play with OUT variables, you will see.

For beginner, difference between function and procedure is less than
small in PostgreSQL. There are two families of stored procedures:
Oracle and Microsoft. Look to their documentation.

Regards
Pavel Stehule

pgsql-general by date:

Previous
From: "Leif B. Kristensen"
Date:
Subject: Re: Stored Procedures and Functions
Next
From: PFC
Date:
Subject: Re: Stored Procedures and Functions