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

相关推荐
ClouGence3 天前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
曹牧4 天前
Oracle EXPLAIN PLAN
数据库·oracle
贤时间4 天前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心4 天前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle
Curvatureflight4 天前
MySQL 深分页越来越慢?从 LIMIT OFFSET 改成游标分页
数据库·oracle
XZ-0700014 天前
MySQL事务
数据库·mysql·oracle
tiancaijiben4 天前
阿里云函数计算FC如何实现网站的定时任务与自动化
数据库·oracle·dba
xfhuangfu4 天前
Oracle 19c 多租户体系架构介绍
数据库·oracle·架构
杨云龙UP4 天前
Spotlight 接入 Oracle 数据库监控操作指南 2026-06-16
数据库·oracle·性能监控·预警·阈值·spotlight·瓶颈分析
unique4 天前
AI Coding 采集方案探索
jvm·人工智能·oracle