Re: Pass column name in preparedstatement

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Antony Paul <antonypaul24(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Pass column name in preparedstatement
Date: 2005-02-15 11:54:09
Message-ID: 4211E2E1.4090506@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Antony Paul 2005-02-15 12:04:56 Re: Pass column name in preparedstatement
Previous Message Antony Paul 2005-02-15 11:20:22 Pass column name in preparedstatement