These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: HQL Query that retrieves data without case sensitivity
PostPosted: Tue Nov 18, 2008 6:14 am 
Newbie

Joined: Thu Jan 24, 2008 12:24 pm
Posts: 5
Hi,

my requirement is like this
I had an emp table where it contains empno,empname, etc
now i write a query which fetches data using where clause of empname, which is like this

from emp e where e.empname='f%'

The above query only retrieves the emp records whose name starts with f ( small f not a cap f)

Now my requirement is i need to write a query where it also retrieves the empname records which starts with F (cap f) also.

Hope you got my problem.

please reply.

I came to know that i can use Criteria for this. But i want to use only hql query.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 18, 2008 6:35 am 
Regular
Regular

Joined: Wed Jun 20, 2007 1:53 am
Posts: 75
use upper function in both the side of where clause condition , for example

from emp e where upper(e.empname)=upper('f%')


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.