[20201218]dbms_output.put_line无法输出前面的空格.txt --//昨天别人问的问题,自己测试看看。 1.环境: SCOTT@book> @ ver1 PORT_STRING VERSION BANNER ------------------------------ -------------- -------------------------------------------------------------------------------- x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 2.测试: SCOTT@book> @ desc_proc sys dbms_output put_line INPUT OWNER PACKAGE_NAME OBJECT_NAME sample : @desc_proc sys dbms_stats gather_%_stats OWNER PACKAGE_NAME OBJECT_NAME SEQUENCE ARGUMENT_NAME DATA_TYPE IN_OUT DEFAULTED ---------- -------------------- ------------------------------ ---------- -------------------- -------------------- --------- ---------- SYS DBMS_OUTPUT PUT_LINE 1 A VARCHAR2 IN N SCOTT@book> set serveroutput on SCOTT@book> exec dbms_output.put_line (' this is a test'); this is a test PL/SQL procedure successfully completed. --//感觉输入参数做了处理。 SCOTT@book> exec dbms_output.put_line (chr(32)||chr(32)||' this is a test'); this is a test PL/SQL procedure successfully completed. --//^_^依旧。 3.上网检索发现: https://stackoverflow.com/questions/2584492/how-to-prevent-dbms-output-put-line-from-trimming-leading-whitespace --//链接给出几种解决方法: SCOTT@book> set serveroutput on SCOTT@book> show serveroutput serveroutput ON SIZE UNLIMITED FORMAT WORD_WRAPPED --//实际上缺省是WORD_WRAPPED。 SCOTT@book> exec dbms_output.put_line(lpad('this', 8, ' ')||' is a test'); this is a test PL/SQL procedure successfully completed. --//这样跟我前面测试一样不行。 SCOTT@book> SET SERVEROUTPUT ON FORMAT WRAPPED SCOTT@book> exec dbms_output.put_line (chr(32)||chr(32)||' this is a test'); this is a test PL/SQL procedure successfully completed. SCOTT@book> SET SERVEROUTPUT ON FORMAT TRUNCATED SCOTT@book> exec dbms_output.put_line (chr(32)||chr(32)||' this is a test'); this is a test PL/SQL procedure successfully completed. --//最后,注意完成要选择关闭,不要显示查看执行计划出现问题。 SCOTT@book> set serveroutput on SCOTT@book> select * from dept where rownum=1; DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK SCOTT@book> @ dpc '' '' PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------- SQL_ID 9babjv8yq8ru3, child number 0 BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END; NOTE: cannot fetch plan for SQL_ID: 9babjv8yq8ru3, CHILD_NUMBER: 0 Please verify value of SQL_ID and CHILD_NUMBER; It could also be that the plan is no longer in cursor cache (check v$sql_plan) 8 rows selected. SCOTT@book> set serveroutput off
[20201218]dbms_output.put_line无法输出前面的空格.txt
来源:这里教程网
时间:2026-03-03 16:17:31
作者:
编辑推荐:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- ORACLE锁的种类和级别
ORACLE锁的种类和级别
26-03-03 - kubernetes-部署Oracle数据库步骤
kubernetes-部署Oracle数据库步骤
26-03-03 - ora-20003报错,ora-06512报错
ora-20003报错,ora-06512报错
26-03-03 - Oracle、NoSQL和NewSQL 数据库技术对比
Oracle、NoSQL和NewSQL 数据库技术对比
26-03-03 - exp和imp详解
exp和imp详解
26-03-03 - oracle删除表中数据(delete与truncate)
oracle删除表中数据(delete与truncate)
26-03-03 - SQL Server数据库mdf文件中了勒索病毒*.mdf.[helpbackup@email.tg].Devos
- G006-ORACLE-INS-SIFS-01 ORACLE 19C SIFS Ins ON RHEL 8.2
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML Redirection
- 查看oracle数据库中,哪些表的字段是null值比较多
查看oracle数据库中,哪些表的字段是null值比较多
26-03-03
