英文:
Oracle : Set column to heading length
问题
我有以下SELECT查询的结果:
CXA|DSTRTG |CB|
---|---------|--|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
列CB的实际名称应该是CBXF,并且数据的长度是CHAR(2),因此结果基于此被截断。
我想要选择的结果如下所示:
CXA|DSTRTG |CBXF|
---|---------|----|
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
我想要自动设置它(所有结果都适应列长度而不是数据长度)。
我尝试增加参数LINESIZE,LONG...,但没有成功。
英文:
I have the following result of a SELECT:
CXA|DSTRTG |CB|
---|---------|--|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
0A2|17-FEB-23|A2|
The column CB name is actually CBXF , and the length of data is CHAR(2) so the result is truncated based on this.
I want the result of the select to be like this
CXA|DSTRTG |CBXF|
---|---------|----|
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
0A2|17-FEB-23|A2 |
I want to set it automatically (all the results fit the column length not the data length)
I tried increasing the parameters LINESIZE , LONG..., didn't work
答案1
得分: 2
现在已经调整好了:
SQL> select * from test;
CXA CBXF
--- ----
0A2 A2
SQL>
英文:
It is the column
you must set.
Test case:
SQL> create table test (cxa varchar2(3), cbxf char(2));
Table created.
SQL> insert into test values ('0A2', 'A2');
1 row created.
Current output (the last column name is missing some letters):
SQL> select * from test;
CXA CB
--- --
0A2 A2
Adjust it:
SQL> column cbxf format a4
Now it is OK:
SQL> select * from test;
CXA CBXF
--- ----
0A2 A2
SQL>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论