Thread: How to create stored procedure in PostgreSQL?

How to create stored procedure in PostgreSQL?

From
Yolanda Valverde
Date:
Holas:

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.

Gracias



How to create stored procedure in PostgreSQL?

From
Lee Kindness
Date:
Yolanda, I think the following page should help you do what you want:

 http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=xfunc-tablefunctions.html

Lee.

Yolanda Valverde writes:
 > Holas:
 >
 > 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.
 >
 > Gracias

Re: How to create stored procedure in PostgreSQL?

From
Jason Hihn
Date:
I'd like to know how to create stored procedures in PostgreSQL, I am working
with functions, but the problem that I have is with the function returning
one variable. I am interested in knowing how to return multiple variables.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Yolanda Valverde
Sent: Thursday, February 13, 2003 10:45 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How to create stored procedure in PostgreSQL?


Holas:

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.

Gracias



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


Re: How to create stored procedure in PostgreSQL?

From
Brandon Craig Rhodes
Date:
Yolanda Valverde <yvalverde@chiusac.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@oit.gatech.edu

Re: How to create stored procedure in PostgreSQL?

From
"Andres Ledesma"
Date:
Just thinking out loud cause don't know very well if this is heretic or
something ..

    define a new structured datatype, and make your function fill and return
this datatype..

Andres