Re: Stored Procedures and Functions

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Harpreet Dhaliwal" <harpreet(dot)dhaliwal01(at)gmail(dot)com>
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Stored Procedures and Functions
Date: 2007-06-02 16:25:06
Message-ID: 162867790706020925w90942ebh9825bd45d480aa5c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dawid Kuroczko 2007-06-02 16:31:19 Re: Transactional DDL
Previous Message Harpreet Dhaliwal 2007-06-02 16:08:31 Re: Transactional DDL