Re: [GENERAL] Using Substitution Variables In PostgreSQL

Поиск
Список
Период
Сортировка
От Achilleas Mantzios
Тема Re: [GENERAL] Using Substitution Variables In PostgreSQL
Дата
Msg-id 2d64c975-1c40-8142-677a-464b9829fb76@matrix.gatewaynet.com
обсуждение исходный текст
Ответ на [GENERAL] Using Substitution Variables In PostgreSQL  (Osahon Oduware <osahon.gis@gmail.com>)
Список pgsql-general
On 16/10/2017 17:08, Osahon Oduware wrote:
> Hi All,
>
> I wanted to find out how to use a substitution variable in an SQL statement that would cause the user to be prompted
fora value. Something similar to the ampersand (&&) in ORACLE.
 
>
> For example, given the SQL statement below:
>     SELECT <col1>,<col2>,<col3>
>     FROM <table>
>     WHERE <col5> = 35
>
> I want the user to be prompted for the value in the WHERE (filter) clause, e.g.
>     SELECT <col1>,<col2>,<col3>
>     FROM <table>
>     WHERE <col5> = ?
>
> I would be glad if someone could point me in the right direction.

Just write a bash script that asks for values and then use the -v feature of psql .


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Force SSL connection
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] Using Substitution Variables In PostgreSQL