MIDRANGE dot COM Mailing List Archive



Home » JAVA400-L » May 2006

RE: Selection a row using jdbc where a column contains embedded blanks on iSeries.



fixed

        Hi Paul,

        But using the "like" keyword such as String sqlstmt = "select
firm, office, acct from Table where Ref  like "  +
         "'" +wrkref.trim() + "%'" ;

        does not return the row either.

        Any idea why NOT??

Rajesh Anand
Email:Rajesh_anand@xxxxxx


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Nicolay
Sent: 16 May 2006 15:15
To: Java Programming on and around the iSeries / AS400
Subject: Re: Selection a row using jdbc where a column contains embedded
blanks on iSeries.


Hi,

The problem is not the embedded blanks... but the trailing blanks !

If your iSeries table is not defined with varying columns, an exact
WHERE will always fail since the database always has trailing blanks in
its columns.

Kind regards,
Paul


----- Oorspronkelijk bericht -----
Van: Anand, Rajesh [mailto:Rajesh_Anand@xxxxxx]
Verzonden: dinsdag, mei 16, 2006 02:26 PM
Aan: java400-l@xxxxxxxxxxxx
Onderwerp: Selection a row using jdbc where a column contains embedded
blanks on       iSeries.

All,

        I've encountered a problem and hoping someone in the list have
come across this.

        I've a database file on iSeries and one of the column has data
like "abc__d00" where "_" represents a blank.

        This column has 2 blanks and when using jdbc sql statement like
below..the resultset does not returns this row.

        String sqlstmt = "select        firm, office, acct from Table
where Ref  = "  + "'" +wrkref.trim() + "'" ;

        wrkref (String ) varaible contains the value = abc__d00.

        WHY doesn't the jdbc returns this row. I know it exists but
wondering if its to do with wrkref defined as String type and nulls in
the string type do not convert to
        characters in jdbc. 

        Any help will be greatly appreciated.

         

Rajesh Anand
Email:Rajesh_anand@xxxxxx
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy,
retain or redistribute it. Click here for important additional terms
relating to this e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact