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

相关推荐
#六脉神剑26 分钟前
myBuilder新版本(8月,Office文件预览、Oracle数据库支持)
数据库·oracle·开发平台·数字化工具·mybuilder
空杆推不起4 小时前
穿透数据库 JOIN 核心:语法分类、底层算法、生产优化与高频坑点全解析
数据库·oracle
传说故事21 小时前
数据库中一些常用英文单词含义
数据库·oracle
dotnet901 天前
批量生成所有表的修改脚本
数据库·sql·oracle
蓝鸟19741 天前
EXISTS子查询SELECT 1与SELECT *到底有无区别?Oracle生产实测解惑(附HIS业务SQL案例)
oracle·his系统·sql优化·数据库调优·exists
一十九的酒1 天前
Oracle Data Guard 备库归档日志满导致同步中断的解决实战
数据库·oracle·oracle-dg 续传·归档空间满
回眸&啤酒鸭1 天前
【回眸】Memmy Agent 智能体落地应用全景指南
数据库·oracle
一只专注api接口开发的技术猿1 天前
OpenClaw 实战:搭建京东商品监控与简易数据分析脚本
大数据·jvm·数据库·oracle·数据分析
Irene19911 天前
Oracle 连接避坑指南:环境+配置+账号
数据库·oracle
鹿鸣天涯1 天前
应急响应:MySQL日志分析
mysql·安全·adb·oracle