Reputation: 3616
I'm using this script:
COLUMN c1 HEADING 'Col1'
COLUMN c2 HEADING 'Col2'
COLUMN c3 HEADING 'Col3'
select c1, c2, c3 from t1 ORDER BY c1
this is what it shows:
Col1 Col2
-------------------- --------------------
Col3
----------------------------------------
aaa bbb
qqq
ccc ddd
rrr
eee fff
ppp
Col1 Col2
-------------------- --------------------
Col3
----------------------------------------
ggg hhh
iii
jjj kkk
lll
mmm nnn
ooo
As shown I don't know why the third column is displayed in a newline and why the header is repeatedly displayed every 3 rows?
Upvotes: 0
Views: 1097
Reputation: 336
This reminds me of a similar "issue" in sqlplus.
Have you tried?
set linesize 200;
edit (additionally):
I believe this removes a lot of the spacing between the columns:
set sqlformat ansiconsole;
And this will put all rows after another:
set pagesize 30;
If its still messy, try increasing the numbers
Upvotes: 2
Reputation: 521289
I agree that your current output is ugly. One workaround would be to just UNION
the header on explicitly:
SELECT t.c1, t.c2, t.c3
FROM
(
SELECT 'Col1' AS c1, 'Col2' AS c2, 'Col3' AS c3, 1 AS pos
FROM dual
UNION
SELECT c1, c2, c3, 2 AS pos
FROM t1
) t
ORDER BY t.pos,
t.c1
This should work assuming that the c1
, c2
, and c3
columns are varchar
, which is compatible with the text appearing in the header record.
Upvotes: 0