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

相关推荐
Albert Tan2 小时前
Oracle EBS 缺少adcfgclone.pl文件
数据库·oracle
典孝赢麻崩乐急1 天前
数据库学习--------数据库日志类型及其与事务特性的关系
数据库·oracle
赵渝强老师1 天前
【赵渝强老师】OceanBase租户的资源管理
数据库·mysql·oracle·oceanbase
帧栈1 天前
开发避坑短篇(12):达梦数据库TIMESTAMP字段日期区间查询实现方案
数据库·sql·oracle
ALLSectorSorft2 天前
相亲小程序聊天与互动系统模块搭建
java·数据库·sql·microsoft·oracle
Python大数据分析@2 天前
SQL 怎么学?
数据库·sql·oracle
数据狐(DataFox)2 天前
大数据集分页优化:LIMIT OFFSET的替代方案
数据库·sql·oracle
胖头鱼的鱼缸(尹海文)2 天前
数据库管理-第352期 从需求看懂Oracle RAC多租户环境的Service(20250729)
数据库·oracle
会掉头发2 天前
PostgreSQL缓冲区管理器
数据库·oracle
bestsun9992 天前
Time drifts can result in unexpected behavior such as time-outs.
数据库·oracle