Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes UPPERing in a prepared statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "UPPERing in a prepared statement" Watch "UPPERing in a prepared statement" New topic
Author

UPPERing in a prepared statement

Ali Ekber
Ranch Hand

Joined: Jun 12, 2005
Posts: 41
I need to upper a search criteria in the WHERE clause in a prepared statement. It is something like this:

... WHERE name=UPPER(?);

But it doesn't work. Is it possible to do UPPER in prepared statement, with a different syntax? Thx.
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

SQL you write differs from one database to others. so can you please tell us which DB are you using?

Before that, my advice is to convert the value you want to convert to uppercase using Java(String.toUpperCase()) then you set as value to your pre compiled query.


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Ali Ekber
Ranch Hand

Joined: Jun 12, 2005
Posts: 41
This is a DB2 instance. Thx.
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

This should work. Try this,

Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

before adding this query to Java, try in DB2 using some SQL editor with some hard coded value. If it works, then this should work with Java as well.

Thanks.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
This is a duplicate of post in same forum with same subject
 
wood burning stoves
 
subject: UPPERing in a prepared statement
 
Similar Threads
Create DB2 database
UPPERing in a prepared statement
what is better
Prepared Statement vs statement
prepared statement....