From: | Dave Cramer <Dave(at)micro-automation(dot)net> |
---|---|
To: | Mihai Gheorghiu <tanethq(at)earthlink(dot)net> |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Syntax of LIKE in PreparedStatement |
Date: | 2002-04-05 21:47:12 |
Message-ID: | 1018043232.20073.102.camel@inspiron.cramers |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Mihai
just set the prepared statement to
"select * from table where name like ?"
and then do a setString(1,"%Smith%")
Dave
On Fri, 2002-04-05 at 16:49, Mihai Gheorghiu wrote:
> When I need to translate a PostgreSQL query such as:
> SELECT * FROM tbl WHERE name = 'Smith';
> into a PreparedStatement, I use something such as:
> sql = con.prepareStatement("SELECT * FROM tbl WHERE name = ?");
> sql.setString(1, myVariable);
>
> How do I translate
> SELECT * FROM tbl WHERE name LIKE '%Smith%';
> I'm not sure what happens to ' and %.
>
> Thank you all.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mihai Gheorghiu | 2002-04-05 21:49:24 | Syntax of LIKE in PreparedStatement |
Previous Message | Dave Cramer | 2002-04-05 16:52:51 | Re: JDBC Driver Problem |