Re: Pass column name in preparedstatement - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Pass column name in preparedstatement
Date
Msg-id 4211E2E1.4090506@opencloud.com
Whole thread Raw
In response to Pass column name in preparedstatement  (Antony Paul <antonypaul24@gmail.com>)
Responses Re: Pass column name in preparedstatement  (Antony Paul <antonypaul24@gmail.com>)
List pgsql-jdbc
Antony Paul wrote:
> Hi all,
>     Is it possible to pass column name to a PreparedStatement as a
> parameter.

No, you can only use parameter placeholders in places which the backend
grammar allows parameters (namely, in expressions). Column names aren't
one of those places.

> Or should I use Statement.

You can use either Statement or PreparedStatement so long as you insert
the column name into the SQL query string yourself before giving it to
the driver.

-O

pgsql-jdbc by date:

Previous
From: Antony Paul
Date:
Subject: Pass column name in preparedstatement
Next
From: Antony Paul
Date:
Subject: Re: Pass column name in preparedstatement