If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > db2 right function returns thousands of blank spaces

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-09-10, 12:13
edumariano edumariano is offline
Registered User
 
Join Date: Dec 2010
Posts: 1
Unhappy 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 12:21.
Reply With Quote
  #2 (permalink)  
Old 12-09-10, 13:38
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Reply With Quote
  #3 (permalink)  
Old 12-09-10, 14:35
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Nick, is 9.7 manuals written for the first grade level?

Quote:
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.1.0.2 os 5.3.0.0
Reply With Quote
  #4 (permalink)  
Old 12-09-10, 17:13
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #5 (permalink)  
Old 12-10-10, 03:11
wilsonfv wilsonfv is offline
Registered User
 
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) )
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On