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

相关推荐
oradh1 小时前
Oracle数据库服务器端编程介绍
数据库·oracle·oracle基础·oracle数据库基础
胖头鱼的鱼缸(尹海文)2 小时前
数据库管理-第423期 Oracle AI DB 23.26.2新特性一览(20260504)
数据库·人工智能·oracle
万事大吉CC3 小时前
【4】深入剖析 Django 之 MTV:ORM 系统核心原理
数据库·python·oracle·django·sqlite
阿kun要赚马内8 小时前
Python中的ORM——SQLAlchemy
数据库·oracle
zxrhhm1 天前
PostgreSQL 中的层级查询 Oracle CONNECT BY 替代方案
数据库·postgresql·oracle
星马梦缘2 天前
数据库作战记录 实验7、8
数据库·sql·oracle
苍煜2 天前
一篇讲懂分库分表:概念、spirngboot实战
数据库·oracle
Jing_jing_X2 天前
MCP (一)是什么?一文讲清 AI 如何连接现实世界
数据库·人工智能·oracle
山峰哥2 天前
SQL优化从入门到精通:20个案例破解性能密码
数据库·sql·oracle·性能优化·深度优先
杨云龙UP2 天前
Windows Server 2012 环境下 Oracle 11.2 使用 expdp 实现自动备份、异地复制与定期清理_20260504
服务器·数据库·windows·mysql·docker·oracle·容器