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

相关推荐
蒸蒸yyyyzwd1 天前
cpp选手秋招学习笔记 day12
笔记·学习·oracle
oradh2 天前
Oracle闪回技术操作总结
数据库·oracle·oracle闪回技术操作总结·oracle闪回·flashback技术
smilejingwei2 天前
Trae+SQLazy 实践 SQL 国产化移植:Oracle => 达梦
数据库·sql·oracle
Irene19912 天前
当前用户查OWNER报错总结:在Oracle中,查询OWNER(或用户名/SCHEMA)报错,本质是权限不足,但错误的表现形式会根据具体场景而不同
oracle
lixora2 天前
Oracle Data Block 详细结构解析
oracle
Code额2 天前
Python asyncio 异步编程全套学习文档(零基础完整版)
python·学习·oracle·async·异步·asyncio
秋田君2 天前
【无标题】
数据库·oracle
JacksonMx3 天前
企业级幂等方案
数据库·spring boot·spring·oracle
Irene19913 天前
生产级探查脚本:数据探查 SQL 示例(无需DBA权限、跨Oracle版本(11g/19c)的表结构探查脚本方案)
oracle
—Miss. Z—3 天前
备份与恢复
数据库·oracle