From: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Using Substitution Variables In PostgreSQL |
Date: | 2017-10-16 14:23:44 |
Message-ID: | 2d64c975-1c40-8142-677a-464b9829fb76@matrix.gatewaynet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 for a 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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2017-10-16 14:27:17 | Re: Using Substitution Variables In PostgreSQL |
Previous Message | Tom Lane | 2017-10-16 14:19:04 | Re: Force SSL connection |