From: | Fabrízio de Royes Mello <fabrizio(at)timbira(dot)com(dot)br> |
---|---|
To: | Andreas Kretschmer <andreas(at)a-kretschmer(dot)de> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: execute block like Firebird does |
Date: | 2018-02-11 13:39:44 |
Message-ID: | CAPfkCSB92QYdXRsAjU63_q9wiA+o7-UB3TyJ=oSJB+GWceJwPw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Em dom, 11 de fev de 2018 às 06:47, Andreas Kretschmer <
andreas(at)a-kretschmer(dot)de> escreveu:
>
>
> Am 11.02.2018 um 06:57 schrieb PegoraroF10:
> > We are migrating our databases from Firebird to PostGres. A useful
> feature
> > Firebird has is Execute Block.
> > What it does is just return a record set from that dynamic SQL, just
> like a
> > PostGres function, but without creating it.
> > It sound like ...
> > execute block returns(ID Integer, Name varchar(50), LastInvoice Date,
> ...)
> > as
> > begin
> > select bla, bla, bla into ...;
> > select bla, bla into ...;
> > suspend;
> > end
> > I know we could create a function but we have several hundred of these
> > blocks running, so ... it would be a huge work to do.
> > So, there is a way to run a dynamic sql which returns a set of records ?
>
> you can use a DO - block:
>
>
> https://www.postgresql.org/docs/current/static/sql-do.html
>
But DO blocks returns "void", I mean you can't return values/records from
this statement.
Regards,
--
Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
From | Date | Subject | |
---|---|---|---|
Next Message | PegoraroF10 | 2018-02-11 13:50:46 | Re: execute block like Firebird does |
Previous Message | Andreas Kretschmer | 2018-02-11 08:46:38 | Re: execute block like Firebird does |