Re: how to Escape single quotes with PreparedStatment - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: how to Escape single quotes with PreparedStatment
Date
Msg-id CA+0W9LNEMxVVkGACi2MQ+dxFZ_Q-XQ81GWenfmcnzqSkEjmFnQ@mail.gmail.com
Whole thread Raw
In response to Re: how to Escape single quotes with PreparedStatment  (JavaNoobie <vivek.mv@enzentech.com>)
Responses Re: how to Escape single quotes with PreparedStatment  (JavaNoobie <vivek.mv@enzentech.com>)
List pgsql-jdbc
On 22 August 2011 22:26, JavaNoobie <vivek.mv@enzentech.com> wrote:

>  String query="SELECT count(*) over () as ROWCOUNT,
> CONSUMER_ID,WENEXA_ID,CONSUMER_NAME,CONTACT_NO,residing_village from
> db_consumer WHERE lower(CONSUMER_NAME) LIKE (lower(?))OR (lower(?)='')  AND
> (lower(RESIDING_VILLAGE) LIKE (lower(?) OR (lower(?)='')) AND
> (lower(WENEXA_ID) LIKE (lower(?))OR(lower(?)='')) LIMIT ? OFFSET ?";

> It throws the previous error:org.postgresql.util.PSQLException: ERROR:
> syntax error at or near "LIMIT"
>  Position: 302
>        at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
>        at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
> Any idea why this could be happening?

You have a syntax error in your query, just like the errors says.
Count the parentheses.

(I really can't believe this thread is still going)

Oliver

pgsql-jdbc by date:

Previous
From: Chris Wareham
Date:
Subject: Re: how to Escape single quotes with PreparedStatment
Next
From: Radosław Smogura
Date:
Subject: Re: how to Escape single quotes with PreparedStatment