Re: execute block like Firebird does
От
Pavel Stehule
Тема
Re: execute block like Firebird does
Дата
Msg-id
CAFj8pRBYOyz45LHdH3HSQLCxfv894W4uXPZ+1jgDO4_hY5EKWQ@mail.gmail.com
Ответ на
Re: execute block like Firebird does (PegoraroF10)
Список
Дерево обсуждения
execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does Adrian Klaver <adrian.klaver@aklaver.com>
Re: execute block like Firebird does Félix GERZAGUET <felix.gerzaguet@gmail.com>
Re: execute block like Firebird does "Peter J. Holzer" <hjp-pgsql@hjp.at>
Re: execute block like Firebird does Thiemo Kellner <thiemo@gelassene-pferde.biz>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does "Daniel Verite" <daniel@manitou-mail.org>
Re: execute block like Firebird does "David G. Johnston" <david.g.johnston@gmail.com>
Re: execute block like Firebird does Adrian Klaver <adrian.klaver@aklaver.com>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does Adrian Klaver <adrian.klaver@aklaver.com>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does "David G. Johnston" <david.g.johnston@gmail.com>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does Adrian Klaver <adrian.klaver@aklaver.com>
Re: execute block like Firebird does Edson Carlos Ericksson Richter <richter@simkorp.com.br>
Re: execute block like Firebird does Andreas Kretschmer <andreas@a-kretschmer.de>
Re: execute block like Firebird does PegoraroF10 <marcos@f10.com.br>
Re: execute block like Firebird does Pavel Stehule <pavel.stehule@gmail.com>
Re: execute block like Firebird does Fabrízio de Royes Mello <fabrizio@timbira.com.br>
Re: execute block like Firebird does Steven Lembark <lembark@wrkhors.com>
Re: execute block like Firebird does Fabrízio de Royes Mello <fabrizio@timbira.com.br>
2018-02-11 14:50 GMT+01:00 PegoraroF10 <marcos@f10.com.br>:
but DO doesn´t return values, or it does ?
execute block returns(ID Integer, Name varchar(50), LastInvoice Date, ...)
as
begin
for select ID, Name from Customers where ... into ID, Name do begin
select bla, bla, bla from functionX(ID) into ...;
if ... then
bla = X
else
bla = Y;
if bla = XXX then
suspend; -- here we return a record and as we are inside a loop we
will return several records;
end
end
As you can see, this entire block can be called from client dynamically,
their result fields are defined when it runs and we can return a set of
records. So, DO doen´t work this way, does it ?
You can use temporary function in PostgreSQL. DO command has not result. Theoretically, you can use a cursor with transaction scope. It can be filled in DO command and outer can be read by FETCH command.
Regards
Pavel
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general- f1843780.html
В списке pgsql-general по дате отправления