Re: User input to queries

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: User input to queries
Date: 2020-12-09 17:09:38
Message-ID: CAHOFxGqJFfxNg8KcwQE==_Z1TwA2gAm93wfnkq3T1rbcZCGh7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Dec 9, 2020 at 10:04 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> While I develop the application's GUI I use the database from the command
> line (psql). While some queries are self-contained others need user input.
> I've not found a search term that locates this information in the
> postgres-12 user manual and my web searches suggest that using '&' should
> work.
>
> I tried the latter with this query but postgres didn't like it. (There may
> well be other errors in it so don't hesitate to point out my mistakes.)
>
> ------
> /* This query selects all activity information for a named person */
>
> /* Specify columns */
> SELECT p.lname, p.fname, p.loc_nbr, p.job_title, p.direct_phone, p.active,
> o.org_name,
> l.loc_nbr, l.loc_name,
> a.act_date, a.act_type, a.notes, a.next_contact
> /* Specify tables. */
> FROM People AS p
> JOIN Organizations AS o ON o.org_nbr = p.org_nbr
> JOIN Locations AS l ON l.org_nbr = o.org_nbr and l.loc_nbr =
> p.loc_nbr
> JOIN Activities AS a ON a.person_nbr = p.person_nbr
> /* Specify rows */
> WHERE p.lname = &p.lname AND p.fname = &p.fname;
> -----
>
> Suggestions on what I should read to learn more about this subject are
> appreciated.
>
> Regards,
>
> Rich

Are you looking for this perhaps?

https://www.postgresql.org/docs/current/sql-prepare.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2020-12-09 17:24:37 Re: User input to queries
Previous Message Rich Shepard 2020-12-09 17:03:54 User input to queries