pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: alla@sergey.com
To: pgsql-general@postgresql.org.pgsql-sql
Subject: Re: Return cursor
Date: 25 May 2001 07:32:47 -0700
Message-ID: <9275d56e.0105250632.667d5bed@posting.google.com> (raw)
References: <9275d56e.0105231020.6bc24751@posting.google.com>
	<9ehged$k4f$1@news.tht.net>
	<9275d56e.0105240427.2fa28c31@posting.google.com>
	<9ej088$ulc$1@news.tht.net>

"Sergey E. Volkov" <sve@raiden.bancorp.ru> wrote in message news:<9ej088$ulc$1@news.tht.net>...
> If you are planing  to use ecpg :
> 
> exec sql declare cuserbase cursor for
>      select column1, column2, column3 from my_table order by 1;
> exec sql open cuserbase;

Thanks, but this is exactly what I am trying to avoid - having select statements 
in client applications.

I want to write stored procedures with all the logic and give the names 
and parameters to my developers, so they could just do the fetch.

In this case, I'll be free to change any underlying logic - tables' names, 
column names, select statements itself, add some extra logic to the 
where clause etc

Alla

P.S. If you are curious, I found something like this:

create function edf_load_user_base()
returns setof edv_user_base as '
select * from edv_user_base
where ... (complex where clause)'
language 'sql';

And then call it as following:

select column1(edf_load_user_base()), column2(edf_load_user_base()) etc

Does anybody know how I can return setof of something other than table%rowtype, 
i.e. can I define a record type my_record and do something like this:

create function edf_load_user_base()
returns setof my_record
....

Sorry to be a pain, but I have a deadline to do the migration and
not enough time to do my research :-((



view thread (6+ messages)

Message-ID: <9275d56e.0105250632.667d5bed@posting.google.com>
Permalink:  ../9275d56e.0105250632.667d5bed@posting.google.com/
Also on:    postgresql.org/message-id/9275d56e.0105250632.667d5bed@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alla@sergey.com, pgsql-general@postgresql.org.pgsql-sql
  Subject: Re: Return cursor
  In-Reply-To: <9275d56e.0105250632.667d5bed@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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