Re: How to write such a query? - Mailing list pgsql-general

From Igor Korot
Subject Re: How to write such a query?
Date
Msg-id CA+FnnTwJFdp20d7mFGjWHKP4NzLNMAqya7_zhMSJdUWuX=MOVw@mail.gmail.com
Whole thread Raw
In response to Re: How to write such a query?  (Amul Sul <sulamul@gmail.com>)
List pgsql-general
Hi, Armul,

On Thu, Jan 6, 2022 at 12:46 AM Amul Sul <sulamul@gmail.com> wrote:
>
> See prepare statement : https://www.postgresql.org/docs/current/sql-prepare.html

The documentation is talking about a way to do it like:

SELECT a, b, c FROM foo WHERE id = $1,

which is equivalent to the

SELECT a, b, c FROM foo WHERE id = ?;

i.e. using unnamed parameter.

Thank you.

>
> On Thu, Jan 6, 2022 at 12:10 PM Igor Korot <ikorot01@gmail.com> wrote:
> >
> > Hi, ALL,
> > In SQLite you can write:
> >
> > SELECT a, b, c FROM foo WHERE id = :id;
> >
> > where ":id" is the named parameter.
> >
> > The query above is similar to
> >
> > SELECT a,b,c FROM foo WHERE id = ?;
> >
> > except that the parameter has a name.
> >
> > Is there a way to write such a SELECT statement with the
> > named parameter in PostgreSQL?
> >
> > Thank you.
> >
> >



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: How to write such a query?
Next
From: Ron
Date:
Subject: Re: How to write such a query?