I want to do something like:
SELECT * FROM Person WHERE lastname LIKE 'Smit%' or with a PreparedStatement
something a little more dynamic, such as
SELECT * FROM Person WHERE lastname LIKE ?%
I've seen numerous explanations of how to "escape" the percent sign through
JDBC. Following those examples I've tried:
SELECT * FROM Person WHERE lastname LIKE ?$% {escape $}
SELECT * FROM Person WHERE lastname LIKE '?$%' {escape $}
The problem is those don't work. Any help would be appreciated.
Mike
Tom Hawtin - 10 Apr 2007 13:59 GMT
> I want to do something like:
>
> SELECT * FROM Person WHERE lastname LIKE 'Smit%' or with a PreparedStatement
> something a little more dynamic, such as
> SELECT * FROM Person WHERE lastname LIKE ?%
Append the '%' to the string either within Java or SQL (LIKE CONCAT(?,
'%')).
Tom Hawtin
Lionel - 16 Apr 2007 13:28 GMT
> I want to do something like:
>
[quoted text clipped - 4 lines]
> I've seen numerous explanations of how to "escape" the percent sign
> through JDBC.
This works with Oracle:
SELECT * FROM Person WHERE lastname LIKE 'Smit!%'