• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

"select 'EML' from dual" returns 32 chars

 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My select query is
SELECT 'EML' FROM DUAL.

when i am fetching the result into a resultset, it is of length 32,i.e., EML followed by 29 white spaces.
Is there any settings in database or jdbc by which my query will return only 3 characters,i.e.,EML.

i am using jdk1.5.0_06, oracle 9i...
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tapas,

you need to PostRealCode - complete Java code to create and process the statement, not just the SQL query.

I'm getting three characters from this command in SQL Developer, so there must be something strange in what you're doing - or in your database. Both is possible.
 
Tapas Chand
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear martin
The actual code is as below

When i got unexpected output from my code, i added the last line (sysout).After that i got the output as

i.e., EML followed by 29 spaces(total 32 chars)
i can trim() the result and use the string, but i want to know the reason of such unexpected behavior of oracle.
my jdk and oracle 9i both resides in SunOS 5.8
 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tapas,
your code looks perfectly OK. There must be a problem either with the database, or with the JDBC driver you're using. Don't understand why this should be happening.

Oracle drivers have built-in tracing capability. Maybe you should try to use these tools. See documentation for Oracle's JDBC drivers.
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic