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

相关推荐
蜜獾云5 小时前
oracle查询所有的表名和注释
oracle
爬山算法7 小时前
Hibernate(84)如何在DevOps流程中使用Hibernate?
oracle·hibernate·devops
曹牧9 小时前
Oracle 表闪回(Flashback Table)
数据库·oracle
码农阿豪12 小时前
Oracle 到金仓数据库迁移实战:一次真正“落地”的国产替代之旅
java·数据库·oracle
曹牧13 小时前
Oracle闪回区配置与故障处理操作指南
数据库·oracle
Apple_羊先森14 小时前
ORACLE数据库巡检SQL脚本--15、表空间的运行状态
数据库·sql·oracle
数据与人14 小时前
ksql 元命令完整帮助
数据库·oracle
姚远Oracle ACE15 小时前
Step-by-Step: 在 Linux 上使用 VMware 安装 Oracle 26ai RAC 数据库
linux·数据库·oracle
sg_knight16 小时前
如何通过 SQL*Plus 连接 Oracle 数据库(使用 Instant Client)
运维·数据库·sql·oracle·database·关系型数据库·sql puls
DBA小马哥17 小时前
Oracle兼容替换案例:某省运营商传输网管系统国产化落地实战
数据库·oracle