SqlPlus 中行显示不全的问题(linesize和long的区别)
2014-10-01 22:56
513 查看
现象:在使用dbms包中调用get_ddl函数查询的时候,sqlplus显示的结果不全。
解决方法:
1.查看官方文档中,说明默认页尺寸中每行是80个字符。
SQL*Plus User's Guide and Reference
6 SQPUG016Formatting SQL*Plus Reports
Typically, a page of a report contains the number of blank line(s) set in the NEWPAGE variable of the SET command, a top title, column headings, your query results, and a bottom title. SQL*Plus displays a report that is too long to fit on one page on several
consecutive pages, each with its own titles and column headings. The amount of data SQL*Plus displays on each page depends on the current page dimensions.
The default page dimensions used by SQL*Plus are shown underneath:
number of lines before the top title: 1
number of lines per page, from the top title to the bottom of the page: 14
number of characters per line: 80
2.将结果复制出来查看,实际上查看结果算最后的换行符恰好是80个字符。验证了官方文档中的说法。
3.官方的解决方法是set linesize。
You may wish to reduce the line size to center a title properly over your output, or you may want to increase line size for printing on wide paper. You can change the line width using the LINESIZE variable of the SET command:
4.但是测试并不有效,继续向下刨。
PL/SQL Packages and Types Reference
87 DBMS_METADATA
6.在官方中查询SET的使用方法
SQL*Plus User's Guide and Reference
其中linesize是设置字符型的,long是设置clob等类型的
7.最后设置宽度查看返回结果,问题解决!
结论:涉及到宽度调整的话 ,先查看结果集的类型,再依据类型进行调整。
SET LINESIZE :characters
SET LONG :LONG, BLOB, BFILE, CLOB, NCLOB and XML
SYS@ORCL>/ DBMS_METADATA.GET_DDL(UPPER('VIEW'),UPPER('V_$PARAMETER'),UPPER('SYS')) -------------------------------------------------------------------------------- CREATE OR REPLACE FORCE VIEW "SYS"."V_$PARAMETER" ("NUM", "NAME", "TYPE", "VA
1.查看官方文档中,说明默认页尺寸中每行是80个字符。
SQL*Plus User's Guide and Reference
6 SQPUG016Formatting SQL*Plus Reports
Setting Page Dimensions
Typically, a page of a report contains the number of blank line(s) set in the NEWPAGE variable of the SET command, a top title, column headings, your query results, and a bottom title. SQL*Plus displays a report that is too long to fit on one page on severalconsecutive pages, each with its own titles and column headings. The amount of data SQL*Plus displays on each page depends on the current page dimensions.
The default page dimensions used by SQL*Plus are shown underneath:
number of lines before the top title: 1
number of lines per page, from the top title to the bottom of the page: 14
number of characters per line: 80
2.将结果复制出来查看,实际上查看结果算最后的换行符恰好是80个字符。验证了官方文档中的说法。
CREATE OR REPLACE FORCE VIEW "SYS"."V_$PARAMETER" ("NUM", "NAME", "TYPE", "VA
3.官方的解决方法是set linesize。
You may wish to reduce the line size to center a title properly over your output, or you may want to increase line size for printing on wide paper. You can change the line width using the LINESIZE variable of the SET command:
SET LINESIZE number_of_characters
4.但是测试并不有效,继续向下刨。
SYS@ORCL>set linesize 900 SYS@ORCL>/ DBMS_METADATA.GET_DDL(UPPER('VIEW'),UPPER('V_$PARAMETER'),UPPER('SYS')) -------------------------------------------------------------------------------- CREATE OR REPLACE FORCE VIEW "SYS"."V_$PARAMETER" ("NUM", "NAME", "TYPE", "VA5.在官方文档,重新查询此函数的定义,发现返回的是CLOB类型而不是字符型,所以setlinesize对clob类型的返回值无效。
PL/SQL Packages and Types Reference
87 DBMS_METADATA
GET_xxx Functions
DBMS_METADATA.GET_DDL ( object_type IN VARCHAR2, name IN VARCHAR2, schema IN VARCHAR2 DEFAULT NULL, version IN VARCHAR2 DEFAULT 'COMPATIBLE', model IN VARCHAR2 DEFAULT 'ORACLE', transform IN VARCHAR2 DEFAULT 'DDL') RETURN CLOB;
6.在官方中查询SET的使用方法
SQL*Plus User's Guide and Reference
SET System Variable Summary
其中linesize是设置字符型的,long是设置clob等类型的SET LIN[ESIZE] {80 | n} | Sets the total number of characters that SQL*Plus displays on one line before beginning a new line. |
SET LONG {80 | n} | Sets maximum width (in bytes) for displaying LONG, BLOB, BFILE, CLOB, NCLOB and XMLType values; and for copying LONG values. |
SYS@ORCL>set long 6666 SYS@ORCL>/ DBMS_METADATA.GET_DDL(UPPER('VIEW'),UPPER('V_$PARAMETER'),UPPER('SYS')) -------------------------------------------------------------------------------- CREATE OR REPLACE FORCE VIEW "SYS"."V_$PARAMETER" ("NUM", "NAME", "TYPE", "VAL UE", "DISPLAY_VALUE", "ISDEFAULT", "ISSES_MODIFIABLE", "ISSYS_MODIFIABLE", "ISIN STANCE_MODIFIABLE", "ISMODIFIED", "ISADJUSTED", "ISDEPRECATED", "DESCRIPTION", " UPDATE_COMMENT", "HASH") AS select "NUM","NAME","TYPE","VALUE","DISPLAY_VALUE","ISDEFAULT","ISSES_MODIFIAB LE","ISSYS_MODIFIABLE","ISINSTANCE_MODIFIABLE","ISMODIFIED","ISADJUSTED","ISDEPR ECATED","DESCRIPTION","UPDATE_COMMENT","HASH" from v$parameter
结论:涉及到宽度调整的话 ,先查看结果集的类型,再依据类型进行调整。
SET LINESIZE :characters
SET LONG :LONG, BLOB, BFILE, CLOB, NCLOB and XML
相关文章推荐
- 在Windows下sqlplus完全正常,可是到Linux下,sqlplus中文显示就出问题了,总是显示“??”,这个问题又怎么解决呢?
- Linux中SQLplus上下键不能显示历史命令的问题
- [转]解决每次从cmd进入sqlplus,都得重新设置pagesize、linesize的问题
- Linux中SQLplus上下键不能显示历史命令的问题
- sql/plus无法显示数据库问题
- windows sqlplus客户端连接oralce数据库中文显示问题
- SQL Plus输出结果的格式化(linesize、pagesize)
- oracle sqlplus中文显示乱码的问题
- oracle终端sqlplus显示乱码问题
- 解决linux下oracle进入sqlplus环境中后退键显示^H、上下键无效与ctrl+l无法清屏等问题【weber出品必属精品】
- android TextView 显示不全的问题解决,此问题是设置了maxLines和ellipsize=end情况下发生的!
- sqlplus 帮助无法显示问题的解决
- 理解sqlplus set linesize
- getDimension与getDimensionPixelOffset与getDimensionPixelSize的区别 (字体显示偏大问题)
- sql*plus显示乱码问题
- Linux中SQLplus上下键不能显示历史命令的问题
- 解决oracle 10g sql *plus 用dbms_output.put_line()输出时的长度限制问题 ORA-20000: ORU-10028: line le
- sqlplus登录方式,列出所有表,列出表结构,sqlplus行和列显示设置,别名,空值问题,连接符,DISTINCT
- sqlplus,set linesize ,set pagesize,
- sqlplus显示查询结果自动换行问题