Thread: User input in psql

User input in psql

From
Ashok Agrawal
Date:
Hi .

Just wanted to know what is equivalent of "Oracle &" in postgresql.

select count(*) from table1 where id =&1 where sqlplus plus will
prompt to enter value for 1. I would like to do the same in psql.

Thanks
Ashok



Re: User input in psql

From
Richard Huxton
Date:
Ashok Agrawal wrote:
> Hi .
> 
> Just wanted to know what is equivalent of "Oracle &" in postgresql.
> 
> select count(*) from table1 where id =&1 where sqlplus plus will
> prompt to enter value for 1. I would like to do the same in psql.

There isn't an equivalent feature, I'm afraid. There are variables you 
can use, but no interactive prompting.  \set myvar foo  SELECT count(*) FROM table1 WHERE id = :foo;

--   Richard Huxton  Archonet Ltd