Unix Technical Forum

More DB2 RTrim() problems...

This is a discussion on More DB2 RTrim() problems... within the DB2 forums, part of the Database Server Software category; --> Hi, On an AIX box using DB2 version 7.1, I've got a table with one particular column which may ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 03:42 PM
Kyle
 
Posts: n/a
Default More DB2 RTrim() problems...

Hi,

On an AIX box using DB2 version 7.1, I've got a table with one
particular column which may (infrequently) be quite large. The table
description is as follows:

db2 => describe table flpwebmsgq

Column Type Type
name schema name Length
Scale Nulls
------------------------------ --------- ------------------ --------
----- -----
UID SYSIBM INTEGER 4
0 No
TIME SYSIBM TIMESTAMP 10
0 No
TYPE SYSIBM VARCHAR 32
0 No
BODY SYSIBM VARCHAR 15000
0 No

4 record(s) selected.

When I do a select on the table, the displaying of the "body"
column makes it basically unreadable for more than one line. What I'd
like to be able to do is something like:

select uid,time,type,rtrim(body) from flpwebmsgq;

This would make it much more readable We also have a bunch of
other tables where the column is defined as VARCHAR(254) because there
is the possibility of larger data in the future, but currently we are
only using a portion of the column's width. So a solution to the
above problem would be helpful for a lot of different tables when we
are trying to verify test results or debug a problem.

Any help is appreciated.

Kyle
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 03:42 PM
Mark Yudkin
 
Posts: n/a
Default Re: More DB2 RTrim() problems...

Is your problem the result of the display in the db2 command line processor?
If so, that is not an RTRIM issue, but an artefact of the way the db2
command processor displays columns with their maximum defined length (to
ensure no truncation). In that case, the solution is to use a more
intelligent utility for displaying data - there are lots of these.

"Kyle" <Kyle_Dyer@hotmail.com> wrote in message
news:a692bab1.0309041325.a82822b@posting.google.co m...
> Hi,
>
> On an AIX box using DB2 version 7.1, I've got a table with one
> particular column which may (infrequently) be quite large. The table
> description is as follows:
>
> db2 => describe table flpwebmsgq
>
> Column Type Type
> name schema name Length
> Scale Nulls
> ------------------------------ --------- ------------------ --------
> ----- -----
> UID SYSIBM INTEGER 4
> 0 No
> TIME SYSIBM TIMESTAMP 10
> 0 No
> TYPE SYSIBM VARCHAR 32
> 0 No
> BODY SYSIBM VARCHAR 15000
> 0 No
>
> 4 record(s) selected.
>
> When I do a select on the table, the displaying of the "body"
> column makes it basically unreadable for more than one line. What I'd
> like to be able to do is something like:
>
> select uid,time,type,rtrim(body) from flpwebmsgq;
>
> This would make it much more readable We also have a bunch of
> other tables where the column is defined as VARCHAR(254) because there
> is the possibility of larger data in the future, but currently we are
> only using a portion of the column's width. So a solution to the
> above problem would be helpful for a lot of different tables when we
> are trying to verify test results or debug a problem.
>
> Any help is appreciated.
>
> Kyle



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 03:42 PM
Serge Rielau
 
Posts: n/a
Default Re: More DB2 RTrim() problems...

Use substr() to truncate the output to be more readable. rtrim() will remove
blanks in the data.
But that does little (as you found) to change the width of the column.
Cheers
Serge


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 03:46 PM
PM \(pm3iinc-nospam\)
 
Posts: n/a
Default Re: More DB2 RTrim() problems...

I just pipe the output and edit the file in those cases.

PM


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 03:47 PM
Knut Stolze
 
Posts: n/a
Default Re: More DB2 RTrim() problems...

Kyle <Kyle_Dyer@hotmail.com> wrote:

> Hi,
>
> On an AIX box using DB2 version 7.1, I've got a table with one
> particular column which may (infrequently) be quite large. The table
> description is as follows:
>
> db2 => describe table flpwebmsgq
>
> Column Type Type
> name schema name Length
> Scale Nulls
> ------------------------------ --------- ------------------ --------
> ----- -----
> UID SYSIBM INTEGER 4
> 0 No
> TIME SYSIBM TIMESTAMP 10
> 0 No
> TYPE SYSIBM VARCHAR 32
> 0 No
> BODY SYSIBM VARCHAR 15000
> 0 No
>
> 4 record(s) selected.
>
> When I do a select on the table, the displaying of the "body"
> column makes it basically unreadable for more than one line. What I'd
> like to be able to do is something like:
>
> select uid,time,type,rtrim(body) from flpwebmsgq;


Pipe the output into "less":

db2 "select uid,time,type,rtrim(body) from flpwebmsgq" | less -S

Then you can use the arrow keys on the keyboard to scroll up/down and
left/right to view the complete output.

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:56 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com