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

相关推荐
小白银子4 小时前
零基础从头教学Linux(Day 62)
数据库·mysql·oracle
dblens 数据库管理和开发工具16 小时前
PostgreSQL模式:数据库中的命名空间艺术
数据库·postgresql·oracle
yumgpkpm18 小时前
Hadoop大数据平台在中国AI时代的后续发展趋势研究CMP(类Cloudera CDP 7.3 404版华为鲲鹏Kunpeng)
大数据·hive·hadoop·python·zookeeper·oracle·cloudera
l1t21 小时前
把ITPUB newkid先生编写的Oracle语法数独求解SQL改写成DuckDB
数据库·人工智能·sql·oracle·duckdb
betazhou21 小时前
Oracle Goldengate 同步过程的同步用户权限设置
数据库·oracle·goldengate·ogg·goldengate授权
0和1的舞者21 小时前
《MySQL数据库进阶(九):数据库备份与恢复(二)》
数据库·mysql·oracle·程序员·策略模式·备份与恢复
末点1 天前
Oracle空间函数ST_AsText配置
oracle·arcsde·st_geometry·st_astext
敲上瘾1 天前
C++ ODB ORM 完全指南:从入门到实战应用
linux·数据库·c++·oracle·db
终生成长者1 天前
MongoDB 操作命令
数据库·mongodb·oracle
小白起 v1 天前
自动更新工期触发器(MYSQL)
数据库·sql·oracle