Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

More DB2 RTrim() problems...

2 views
Skip to first unread message

Kyle

unread,
Sep 4, 2003, 5:25:59 PM9/4/03
to
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

Mark Yudkin

unread,
Sep 5, 2003, 4:43:40 AM9/5/03
to
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...@hotmail.com> wrote in message
news:a692bab1.0309...@posting.google.com...

Serge Rielau

unread,
Sep 5, 2003, 2:11:51 PM9/5/03
to
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


PM (pm3iinc-nospam)

unread,
Sep 12, 2003, 2:06:53 AM9/12/03
to
I just pipe the output and edit the file in those cases.

PM


Knut Stolze

unread,
Sep 12, 2003, 2:18:08 PM9/12/03
to
Kyle <Kyle...@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

0 new messages