Discussion:
How to create stored procedure in PostgreSQL?
Yolanda Valverde
2003-02-13 15:44:49 UTC
Permalink
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 ***@postgresql.org so that your
message can get through to the mailing list cleanly
Yolanda Valverde
2003-02-13 15:51:41 UTC
Permalink
Hello:

I would like to create stored procedure in PostgreSQL. The Functions
doesn't work because the return only one value, and I want to receive
several values in one procedure call.

Thanks.




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ***@postgresql.org so that your
message can get through to the mailing list cleanly
Jason Hihn
2003-02-13 16:02:33 UTC
Permalink
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-***@postgresql.org
[mailto:pgsql-general-***@postgresql.org]On Behalf Of Yolanda Valverde
Sent: Thursday, February 13, 2003 10:45 AM
To: pgsql-***@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 ***@postgresql.org so that your
message can get through to the mailing list cleanly


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ***@postgresql.org)
Lee Kindness
2003-02-13 15:57:38 UTC
Permalink
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.
Post by Yolanda Valverde
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 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ***@postgresql.org)
Brandon Craig Rhodes
2003-02-13 16:09:57 UTC
Permalink
Post by Yolanda Valverde
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 ***@oit.gatech.edu

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
Andres Ledesma
2003-02-13 19:18:37 UTC
Permalink
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


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

Loading...