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

相关推荐
cooldream20093 小时前
深入理解主从数据库架构与主从复制
数据库·oracle·数据库架构·系统架构师
alpha xu1 天前
Qwen智能体qwen_agent与Assistant功能初探
数据库·人工智能·python·oracle·智能体·千问agent
文牧之1 天前
Oracle 通过 ROWID 批量更新表
运维·数据库·oracle
Bing@DBA1 天前
Oracle 19c 静默安装
数据库·oracle
听雪楼主.1 天前
Oracle adg环境下调整redo日志组以及standby日志组大小
oracle·adg
消失在人海中2 天前
oracle 会话管理
数据库·oracle
小Tomkk2 天前
2025年5月15日前 免费考试了! Oracle AI 矢量搜索专业认证
数据库·人工智能·oracle
菲兹园长2 天前
MySql(基础)
数据库·mysql·oracle
潇湘秦2 天前
Oracle非归档模式遇到文件损坏怎么办?
数据库·oracle
杨云龙UP3 天前
SQL Server 中的 GO 及其与其他数据库的对比
数据库·sql·mysql·oracle·sqlserver