You can make it interactive if you are working from a unix box.
jamest@hobbes:~$ more zip.sql
\echo -n 'Zip to search for: '
\set value `read input; echo $input`
select * from zipcode where zip = :value
Not sure how/if you could do this on a windows box.
Take Care,
James
On Thursday 25 March 2004 08:45 am, you wrote:
> > > I have a question regarding psql. As I am more familiar with oracle I
> > > can write the following select and make it rather flexible:
> > > select name
> > > from name_table
> > > where person_id = &id;
> > > The &id portion is what I am looking for in PostgreSQL. Basically when
> > > running this query, the person running the query is prompted to supply
> > > a value. What is the equivalent in postgres?
>
> It doesn't work interactively, but you can assign variables like this:
>
> select name from name_table where person_id = :id;
>
> I have to admit there are some sqlplus features I miss too (like the break
> and compute features), and maybe one of these days I'll miss them enough
> to add them to psql. :-)
> --
> Mike Nolan
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
--
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561
Kansas State University Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<