Re: [SQL] Forming Query - Mailing list pgsql-sql

From Federico Passaro
Subject Re: [SQL] Forming Query
Date
Msg-id 35EFAB65.80F7A51B@link.it
Whole thread Raw
In response to Forming Query  (Ronnie Doggart <rdoggart@netcomuk.co.uk>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] Concatenation in selects
Next
From: Stuart Rison
Date:
Subject: [SQL] composite primary keys.