SQL 为 oracle cmd 行设置线宽

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9745791/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:52:13  来源:igfitidea点击:

Set line width for oracle cmd line

sqloraclerelational-databasedatabase-schema

提问by David Garcia

I am using SET LINESIZE 32767for displaying properly data in tables, however there is a table that does not accommodate all the columns, also what is the difference between linesize and SET NUM

SET LINESIZE 32767用于在表格中正确显示数据,但是有一个表格不能容纳所有列,linesize 和 linesize 之间有什么区别SET NUM

TABLE

桌子

CREATE TABLE STAFF(
EMP_ID NUMBER NOT NULL,
EMP_NAME VARCHAR2(20),
EMP_DOB DATE,
EMP_TEL VARCHAR2(20),
EMP_EMAIL VARCHAR2(50),
EMP_ADDR VARCHAR2(100),
EMP_HIREDATE DATE,
EMP_ENDDATE DATE,
EMP_SALARY NUMBER(7,2),
EMP_SUPERVISOR NUMBER,
 JOB_CODE NUMBER,
 BRA_CODE NUMBER);

INSERT SAMPLE

插入样品

INSERT INTO STAFF VALUES (NULL,'Andres Baravalle',to_date('25/03/1975','dd/mm/YYYY'),'723 3403-2817','[email protected]','P.O. Box 879, 1742 Porttitor',to_date('15/04/2007','dd/mm/YYYY'),to_date('19/02/2007','dd/mm/YYYY'),49670,NULL,1,10);

SELECT * FROM STAFF;yields the following

SELECT * FROM STAFF;产生以下

output

输出

Edit----

编辑 - -

Guys how can i get rid of all the space in the timestamp attributes

伙计们,我怎样才能摆脱时间戳属性中的所有空间

Get rid of space

摆脱空间

回答by Mouna Cheikhna

SET LINESIZEsets the total number of characters that SQL*Plus displays on one line before beginning a new line.

SET LINESIZE设置 SQL*Plus 在开始新行之前在一行中显示的字符总数。

However SET NUMis totaly different and sets the default width for displaying numbers.

但是SET NUM是完全不同的,它设置了显示数字的默认宽度。

see here

这里

try setting also your pagesize to be able to see all your table content n one page :

尝试设置您的页面大小,以便能够在一页中看到所有表格内容:

set pagesize n

and increasing your linesize

并增加你的线型

回答by gfortune

It looks like your console is wrapping for you. Have you tried outputting that data to a text file and opening it in a proper text editor? Looking it through a console is always going to be constrained by the limits of the console. Spool it out to a file and see what you get.

看起来您的控制台正在为您包装。您是否尝试将该数据输出到文本文件并在适当的文本编辑器中打开它?通过控制台查看它总是会受到控制台限制的限制。假脱机到一个文件,看看你得到了什么。

回答by Andrew Russell

Additionally answer you last edit, you can reformat the various columns using "column".

另外回答您上次编辑,您可以使用“列”重新格式化各个列。

COLUMN emp_id format a20
COLUMN emp_tel format a15
COLUMN dept_time format a21
COLUMN arrv_time format a21

Which will format the fields above and wrap excess onto the next line.

这将格式化上面的字段并将多余的内容包装到下一行。