Re: fold a long line into short lines, how ?
Posted in 1995
Kuo-Chien Kai (kckai@cc.nthu.edu.tw) wrote:
: I have a table named my_tab which contains 2 columns:
: col1: 30-char long
: col2: 120-char long
: If I execute 'select * from my_tab' under isql, each output line will
: cross lines. I wish the output can be prepared in either way of the
: followings. Is this possible ?
: (1) col1 col2
: --------------------- -------------------------
: this is row1 of col1 this is row1 of col2, and
: this is a very long long
: long row .........
: this is row2 of col1 this is row2 of col2, and
: this is a very long long
: long row .........
I doubt if you'll be able to get this in straight SQL
:
: (2)
: this is row1 of col1
: this is row1 of col2, and
: this is a very long long
: long row .........
: <- a blank line, used as a record separator
: this is row2 of col1
: this is row2 of col2, and
: this is a very long long
: long row .........
this will get you close:
SELECT col1, col2[1,30], col2[31,60], col2[61,90], col2[91,120] ...
This is untested; you might have a problem with rows where col2 has
less than 90 bytes filled in.
=======================================================================
Dennis J. Pimple dennisp@informix.com Opinions expressed
Senior Consultant -------------------- are mine, and do not
Informix Software Inc Voice: 303-850-0210 necessarily reflect
Denver Colorado USA Fax: 303-779-4025 those of my employer.