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

相关推荐
OLDERHARD1 小时前
Java - MyBatis(上)
java·oracle·mybatis
bug菌¹17 小时前
滚雪球学Oracle[1.3讲]:Oracle数据库架构基础
数据库·oracle·数据库架构
bug菌¹1 天前
滚雪球学Oracle[2.1讲]:Oracle数据库安装与配置
数据库·oracle
wdxylb1 天前
MySQL数据库用户权限控制的实现方法
数据库·mysql·oracle
bug菌¹1 天前
滚雪球学Oracle[6.1讲]:高级特性与实战案例
数据库·oracle
文牧之1 天前
PostgreSQL 和Oracle 表压缩的对比
运维·数据库·postgresql·oracle
bug菌¹1 天前
滚雪球学Oracle[1.1讲]:Oracle数据库基础概念
数据库·oracle
爱吃牛肉的大老虎1 天前
Oracle架构之表空间详解
数据库·oracle·架构
运维之美@1 天前
oracle数据备份和导入
数据库·oracle
jnrjian1 天前
Oracle datafile 数目限制是多少
数据库·oracle