Обсуждение: Forming Query

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

Forming Query

От
Ronnie Doggart
Дата:
Hi All,

I want to prompt a user for information in a query. In Oracle the format
would be

select part_no, description from pricing where part_no like '&1';

what is it using psql and postgresql.

Regards
Ronnie Doggart


Re: [SQL] Forming Query

От
Federico Passaro
Дата:
Ronnie Doggart wrote:

> Hi All,
>
> I want to prompt a user for information in a query. In Oracle the format
> would be
>
> select part_no, description from pricing where part_no like '&1';
>
> what is it using psql and postgresql.
>
> Regards
> Ronnie Doggart

  At the best of my knowledge there is no such a feature in psql, but you
can use a shell script like the following one:

_________________________________________________________________
#!/bin/bash

echo -n "Type Part No: "
read  PART_NO

psql <your database name>  <<EOF

select part_no, description from pricing where part_no like  ${PART_NO};

EOF
_________________________________________________________________


Cheers

federico