Re: [SQL] Forming Query

From: Federico Passaro <fede(at)link(dot)it>
To: Ronnie Doggart <rdoggart(at)netcomuk(dot)co(dot)uk>, PostgreSQL sql <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Forming Query
Date: 1998-09-04 08:57:09
Message-ID: 35EFAB65.80F7A51B@link.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stuart Rison 1998-09-04 14:21:05 [SQL] composite primary keys.
Previous Message Bruce Momjian 1998-09-04 01:04:32 Re: [SQL] Concatenation in selects