l ; 提示上次输入的sql 内容 如果去掉; sqlplus

Information in this document applies to any platform.

SYMPTOMS

You have a script that contains a SQL statement with two semicolons (;) at the end. Executing this script in SQL*Plus 8.0.6 shows only the queried records in the spooled output file. However, with SQL*Plus 10.2.x and higher, the spool output contains the actual SQL statement in addition to the queried records.

For Example:

Your script (call it mysql.sql) has the following code:

Select 'x' from dual;

;

Executing this script in SQL*Plus 10.2.x and higher yields output:

SQL> @mysql.sql

'

x

1* Select 'x' from dual

This includes the actual SQL statement, thus corrupting spooled output for further processing.

This was not seen in SQL*Plus 8.0.6 sqlplus. The output from SQL*Plus 8.0.6 yielded:

SQL> @mysql.sql

'

x

CHANGES

This is seen after migrating scripts from SQL*Plus 8.0.6 (usually part of E-Business Suite) to SQL*Plus 10.2.x and higher.

CAUSE

By Default, the semicolon ';' used as "Only character" on a line is interpreted as "show content of buffer". Buffer usually contains last executed SQL statement, thus it shows the SQL statement of the same script.

SOLUTION

To change behavior of ";" from "show buffer", you must set it as a Block terminator.

For Example, you set the following for BLOCKTERMINATOR in your SQL*Plus environment:

set blockterminator ';'

If it is required at script level, the script could be modified as:

set blockterminator ';'

select 'x' from dual;

;

set blockterminator off

相关推荐
jnrjian5 天前
ORA-01017 查找机器名 用户名 以及library cache lock 参数含义
数据库·oracle
TTc_5 天前
oracle中的union和union all有什么区别?
数据库·oracle
山峰哥5 天前
吃透 SQL 优化:告别慢查询,解锁数据库高性能
服务器·数据库·sql·oracle·性能优化·编辑器
南 阳5 天前
Python从入门到精通day37
数据库·python·oracle
轩情吖5 天前
MySQL库的操作
android·数据库·mysql·oracle·字符集·数据库操作·编码集
脱发的老袁5 天前
【数据库】Oracle手动清理归档日志
数据库·oracle
jnrjian5 天前
Oracle 共享池 库缓存下的 Library Cache Lock
数据库·缓存·oracle
新缸中之脑6 天前
在Reddit上探索未满足的需求
数据库·oracle
light blue bird6 天前
产线多并发客户端指令操作场景组件
jvm·oracle·.net·winform
坐吃山猪6 天前
Neo4j04_数据库事务
数据库·oracle·neo4j