设置了x变量,当CMD窗口关闭后,变量失效。
[glogin.sql] D:\app\Administrator\product\11.2.0\dbhome_1\sqlplus\admin\glogin.sql
--
-- Copyright (c) 1988, 2005, Oracle. All Rights Reserved.
--
-- NAME
-- glogin.sql
--
-- DESCRIPTION
-- SQL*Plus global login "site profile" file
--
-- Add any SQL*Plus commands here that are to be executed when a
-- user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
-- This script is automatically run
--
REM Number of lines of SELECT statement output before reprinting headers
SET PAGESIZE 999
REM Width of displayed page, expressed in characters
SET LINESIZE 132
REM Enable display of DBMS_OUTPUT messages. Use 1000000 rather than
REM "UNLIMITED" for databases earlier than Oracle Database 10g Release 2
SET SERVEROUTPUT ON SIZE UNLIMITED FORMAT WRAPPED
REM Change default to "vi improved" editor
DEFINE _EDITOR = /usr/local/bin/vim
REM Format misc columns commonly retrieved from data dictionary
COLUMN segment_name FORMAT A30 WORD_WRAP
COLUMN object_name FORMAT A30 WORD_WRAP
REM Set the prompt (works in SQL*Plus from Oracle9i Database or later0
SET SQLPROMPT "_USER‘@‘_CONNECT_IDENTIFIER > "

2.3.7 SQL*Plus中的错误处理
当运行脚本时,碰到错误时希望能停止运行。使用下面命令可以达到目的。
SQL> WHENEVER SQLERROR EXIT SQL.SQLCODE
(当错误时,返回值为非零。)
或者:
SQL> WHENEVER SQLERROR SQL.SQLCODE EXIT ROLLBACK
(回滚处理)