如何格式化我的 oracle 查询以使列不换行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/188118/
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
How do I format my oracle queries so the columns don't wrap?
提问by someguy
I've tried this, but it doesn't work:
我试过这个,但它不起作用:
col * format a20000
Do I really have to list every column specifically? That is a huge pain in the arse.
我真的必须专门列出每一列吗?这是一个巨大的痛苦。
回答by someguy
Never mind, figured it out:
没关系,想通了:
set wrap off
set linesize 3000 -- (or to a sufficiently large value to hold your results page)
Which I found by:
我通过以下方式找到的:
show all
And looking for some option that seemed relevant.
并寻找一些似乎相关的选项。
回答by Patrick Cuff
I use a generic query I call "dump" (why? I don't know) that looks like this:
我使用一个我称之为“转储”的通用查询(为什么?我不知道),看起来像这样:
SET NEWPAGE NONE
SET PAGESIZE 0
SET SPACE 0
SET LINESIZE 16000
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET TERMOUT OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
SET COLSEP |
spool &1..txt
@@&1
spool off
exit
I then call SQL*Plus passing the actual SQL script I want to run as an argument:
然后我调用 SQL*Plus 传递我想作为参数运行的实际 SQL 脚本:
sqlplus -S user/password@database @dump.sql my_real_query.sql
The result is written to a file
结果写入文件
my_real_query.sql.txt
my_real_query.sql.txt
.
.
回答by Camilo Pe?a
set WRAP OFF
set PAGESIZE 0
Try using those settings.
尝试使用这些设置。
回答by Aziz Zoaib
set linesize 3000
set wrap off
set termout off
set pagesize 0 embedded on
set trimspool on
Try with all above values.
尝试使用上述所有值。