Re: How to create stored procedure in PostgreSQL?

From: Brandon Craig Rhodes <brandon(at)oit(dot)gatech(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to create stored procedure in PostgreSQL?
Date: 2003-02-13 16:09:57
Message-ID: w6fzqs6u22.fsf@guinness.ts.gatech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yolanda Valverde <yvalverde(at)chiusac(dot)com> writes:

> Me gustaría saber como crear procedimientos almacenados en PostgreSQL, yo
> he trabajado con funciones, pero el problema que tengo es que la funcion
> retorna un solo valor; lo que a mi me interesa saber es como retornar
> varios valores.

create table two_integers (integer1 int, integer2 int);

create function square_and_cube(int) RETURNS setof two_integers
AS 'select $1*$1, $1*$1*$1;' LANGUAGE SQL;

SELECT * FROM square_and_cube(3);
-->
integer1 | integer2
----------+----------
9 | 27

http://www3.us.postgresql.org/users-lounge/docs/7.3/postgres/xfunc-tablefunctions.html

--
Brandon Craig Rhodes http://www.rhodesmill.org/brandon
Georgia Tech brandon(at)oit(dot)gatech(dot)edu

In response to

Browse pgsql-general by date

  From Date Subject
Next Message chris.gamble 2003-02-13 16:37:03 Restore from 7.3 to 7.2
Previous Message Jason Hihn 2003-02-13 16:02:33 Re: How to create stored procedure in PostgreSQL?