-->
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.  [ 1 post ] 
Author Message
 Post subject: strange problem with union all query
PostPosted: Thu May 17, 2007 5:00 am 
Newbie

Joined: Thu May 17, 2007 4:00 am
Posts: 1
Hello,

I have a strange problem with following query:

Quote:
SELECT 'PDF' dsp, 'PDF' ret FROM dual UNION ALL SELECT 'XXLS' dsp, 'XLS' ret FROM dual

Which of course should return following result:
dsp ret
PDF PDF
XXLS XLS


And I get:
dsp ret
PDF P
XXLS X


I noticed that if column contains strings with the same length (in my example
'PDF' and 'XLS' with length 3) only first sign of string is present in result set ('P' and 'X', resp.).

I use createSQLQuery method of org.hibernate.Session:

Code:
String sql = "select 'PDF' dsp, 'PDF' ret from dual union all select 'XXLS' dsp, 'XLS' ret from dual";
Query query = session.createSQLQuery(sql);
List result = q.list();


I would not like to change the query.

Thx in advance,
Michal


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

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.