Re: Any reasons for 'DO' statement not returning result?
От | Francisco Olarte |
---|---|
Тема | Re: Any reasons for 'DO' statement not returning result? |
Дата | |
Msg-id | CA+bJJbzFR_hfppSeS2Ly-JOAupNF5QyhgSSM=W-=KcXqisVEfQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Any reasons for 'DO' statement not returning result? (Xtra Coder <xtracoder@gmail.com>) |
Список | pgsql-general |
On Fri, Aug 12, 2016 at 11:34 PM, Xtra Coder <xtracoder@gmail.com> wrote: ... > In my particular case I'm more interested in an easy way to create complex > SELECTs that require usage of variables in the one-time through-away scripts > (some-time during experiments for implementation of functions, to see > immediate results of the intermediate code). The easiest way would be > MsSQL-like when declaring a variable outside of SP actually makes it visible > globally in current session. In such case I do not need 'DO' at all and this > is simple. Probably PostgreSQL has another way to make that thing simple. If you are just interested in avoiding some mistakes, and/or parametrizing some queries from the command line, psql ( the CLI program ) has macro expansion with some sql quoting capabilities, see https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-VARIABLES and be sure to scroll down to "SQL Interpolation" after the built in variables list and read that. I've used it several times, just remember it's a macro processor and it's done by psql, not by the server. Francisco Olarte.
В списке pgsql-general по дате отправления: