Search Postgresql Archives

Re: Stored Procedures and Functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Harpreet Dhaliwal wrote:

> 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. 

I think that your questions have not been answered yet.

Yes, it is true, PostgreSQL doesn't have procedures, only functions.

The difference between a function and a procedure is that the former
has a return value, while the latter does not. Procdures can hand back
results via output parameters.

The lack of procedures in PostgreSQL is mitigated by the fact that you
can achieve everything you need with a function:

- If you don't need to return results at all, you define a function
  with return type "void" (which means that nothing is returned).

- If you need to return more than one result, you can define a
  function with a composite return type (or equivalently with
  what PostgreSQL calls "output parameters").

Yours,
Laurenz Albe


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux