Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    1

    Unhappy Unanswered: db2 right function returns thousands of blank spaces

    When i run this in my db2 udb v8.2.9:
    select nr_rg || right('000' || rtrim(char(nr_seq)),3) from (select distinct nr_rg, nr_seq from ii.TB_INF_COMPLEMENTAR) temp1 > file.txt
    to concatenate 2 columns in order to generate a positional file (1 8, 9 11) that will be imported by db2 main frame, it returns thousands of blank spaces after the eleventh caracter and makes the file very big, aprox 23gb. I've tried substr, rtrim, cast char, etc, etc.
    PS. This happens when I run in db2 command line.
    I would appreciate if someone could help me on this issue.

    Thanks in advance.
    Last edited by edumariano; 12-09-10 at 13:21.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

  3. #3
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Nick, is 9.7 manuals written for the first grade level?

    Figure 1. Precedence of Operations
    Really? People reading this need this to be explained to them, and via pictures?!?!
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by Cougar8000 View Post
    Nick, is 9.7 manuals written for the first grade level?
    I think they are for people who don't like to assume things.

    Quote Originally Posted by Cougar8000 View Post
    Really? People reading this need this to be explained to them, and via pictures?!?!
    You may be interested to know that there are programming languages and environments where the operator precedence is different from what you learned in grade 1.

  5. #5
    Join Date
    Apr 2009
    Posts
    42
    right() returns CLOB, BLOB, varcha(4000) depends on what type of value you input.
    so after do the right() function, try cast it to character,
    like this: cast( right(...) as char(10) )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •