Re: Adding flexibilty to queries

From: Mike Nolan <nolan(at)gw(dot)tssi(dot)com>
To: pgsql-general(at)postgresql(dot)org (pgsql general list)
Subject: Re: Adding flexibilty to queries
Date: 2004-03-25 14:45:40
Message-ID: 200403251445.i2PEjfFf014846@gw.tssi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Garamond 2004-03-25 14:52:42 Re: primary key in table hierarchy
Previous Message Rob Hoopman 2004-03-25 14:38:39 Re: self referencing tables/ nested sets etc...