pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to return records from a function
3+ messages / 2 participants
[nested] [flat]
* How to return records from a function
@ 2003-02-02 15:44 John Cavacas <oogly@rogers.com>
0 siblings, 1 reply; 3+ messages in thread
From: John Cavacas @ 2003-02-02 15:44 UTC (permalink / raw)
To: pgsql-sql
Hello everyone.
I've spent the last few hours trying to come up with a function that
at the most basic returns the result of a SELECT * FROM <table>.
This is easy to do in something like MSSQL or Oracle. For example in
MSSQL i can do something like:
CREATE PROCEDURE proc_name AS
BEGIN
SELECT * FROM sometable
END
How do I do something like that with a Postgresql function/stored
procedure? All I really want to know is how to by using a function how
can I return the results of a SELECT * query!?
The end result of the query I need is more complicated, but I can't
even get something that easy to work. Are functions unable to return
result sets?? All of the examples i've seen always return a single
value, like an int. That doesn't do me any good.
I want to use a few stored procedures to create some faster processing
for some queries that involve 3-4 tables plus require some input
parameters, and return a result set.
Any help would be appreciated. I've just recently started using
PostgreSQL and I'm very impressed! I'm sure I'm jsut overlooking
something easy, but for the life of me i just can't figure it out.
Thanks,
John
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to return records from a function
@ 2003-02-02 15:52 jasiek@serwer.skawsoft.com.pl
parent: John Cavacas <oogly@rogers.com>
0 siblings, 1 reply; 3+ messages in thread
From: jasiek@serwer.skawsoft.com.pl @ 2003-02-02 15:52 UTC (permalink / raw)
To: John Cavacas <oogly@rogers.com>; +Cc: pgsql-sql
Did you look at
http://techdocs.postgresql.org/guides/SetReturningFunctions
? You need Postgresql 7.3 to do this.
Regards,
Tomasz Myrta
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to return records from a function
@ 2003-02-02 16:34 John Cavacas <oogly@rogers.com>
parent: jasiek@serwer.skawsoft.com.pl
0 siblings, 0 replies; 3+ messages in thread
From: John Cavacas @ 2003-02-02 16:34 UTC (permalink / raw)
To: pgsql-sql
Thanks!
That's somewhat of what i was looking for. However it seems that what I
wanted to do is still not possible.
I'm writing a Java application and wanted to use CallableStatement to call a
PostgreSQL function. However it seems that the driver does not implement
that functionality. I guess I can just use a regular statement calling a
function but there seems to be problems doing that as well. Are there any
other JDBC drivers for PostgreSQL?
Thanks,
john
----- Original Message -----
From: <jasiek@serwer.skawsoft.com.pl>
To: "John Cavacas" <oogly@rogers.com>
Cc: <pgsql-sql@postgresql.org>
Sent: February 2, 2003 10:52 AM
Subject: Re: [SQL] How to return records from a function
> Did you look at
> http://techdocs.postgresql.org/guides/SetReturningFunctions
> ? You need Postgresql 7.3 to do this.
> Regards,
> Tomasz Myrta
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-02-02 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-02 15:44 How to return records from a function John Cavacas <oogly@rogers.com>
2003-02-02 15:52 ` jasiek@serwer.skawsoft.com.pl
2003-02-02 16:34 ` John Cavacas <oogly@rogers.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox