Re: Adding flexibilty to queries - Mailing list pgsql-general

From Mike Nolan
Subject Re: Adding flexibilty to queries
Date
Msg-id 200403251445.i2PEjfFf014846@gw.tssi.com
Whole thread Raw
In response to Adding flexibilty to queries  (Alan Carbutt <arcarbut@adams.edu>)
Responses Re: Adding flexibilty to queries
List pgsql-general
> > 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





pgsql-general by date:

Previous
From: Rob Hoopman
Date:
Subject: Re: self referencing tables/ nested sets etc...
Next
From: Michael Meskes
Date:
Subject: Re: Solaris ecpg program doesn't work - pulling my hair out!