Обсуждение: User input in psql

Поиск
Список
Период
Сортировка

User input in psql

От
Ashok Agrawal
Дата:
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

От
Richard Huxton
Дата:
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