Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UPPERing in a prepared statement

 
Ali Ekber
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ali Ekber
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a DB2 instance. Thx.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should work. Try this,

 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a duplicate of post in same forum with same subject
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic