Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"select 'EML' from dual" returns 32 chars

 
Tapas Chand
Ranch Hand
Posts: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • 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...
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • 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: 583
8
BSD Java
  • Mark post as helpful
  • send pies
  • 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 Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic