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

相关推荐
掘根15 分钟前
【消息队列项目】SQLite简单介绍
java·oracle·sqlite
杨云龙UP9 小时前
从0搭建Oracle ODA NFS异地备份:从YUM源到RMAN定时任务的全流程
linux·运维·数据库·oracle
JSUITDLWXL10 小时前
Oracle记录被锁的查询与强制删除方法
数据库·oracle
潇湘秦12 小时前
ORACLE_PDB_SID和ORACLE_SID的区别
数据库·oracle
聪聪那年2213 小时前
Oracle 11g windows 10安装与卸载
数据库·oracle
云和恩墨13 小时前
AI驱动的Oracle SQL优化:从经验依赖到智能协同的三大价值
人工智能·sql·oracle·深度优先·dba
尋有緣14 小时前
力扣1069-产品销售分析II
leetcode·oracle·数据库开发
张较瘦_15 小时前
数据库 | 从宠物管理系统看懂数据库多表关联查询:把零散的数据“串”起来
数据库·oracle·宠物
零日失眠者16 小时前
【Oracle入门到删库跑路-06】核心技能:存储过程和函数
数据库·oracle
LucidX16 小时前
Mysql 数据库部署
数据库·oracle