Re: Prompt for parameter value in psql

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Tiffany Thang <tiffanythang(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Prompt for parameter value in psql
Date: 2018-03-16 15:18:44
Message-ID: CANu8FizB-1cYE__SRj3+2oHMGVQBpEZ23KHogz4Yk1Eb5RgzHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 16, 2018 at 11:12 AM, Tiffany Thang <tiffanythang(at)gmail(dot)com>
wrote:

> Hi,
> Would it be possible to prompt for a user input in psql like in Oracle
> sqlplus?
>
> In oracle, we use the & sign, for example,
> select * from emp where empid=&empidvalue;
>
> Thanks.
>

*https://www.postgresql.org/docs/9.6/static/app-psql.html
<https://www.postgresql.org/docs/9.6/static/app-psql.html> \prompt [ text ]
name *

*Prompts the user to supply text, which is assigned to the variable name.
An optional prompt string, text, can be specified. (For multiword prompts,
surround the text with single quotes.)*

*By default, \prompt uses the terminal for input and output. However, if
the -f command line switch was used, \prompt uses standard input and
standard output.*

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2018-03-16 15:18:51 Re: Prompt for parameter value in psql
Previous Message David G. Johnston 2018-03-16 15:17:50 Re: SELECT .. FOR UPDATE: find out who locked a row