sqlterminator
?
?
SQLPLUS的sqlterminator參數(shù)可以在后面跟3個(gè)東西,分別是ON、OFF和character
?
SQL> set sqlterminator ON|OFF|c
?
c specifies the character that ends an SQL statement. The default is the semicolon (;).
The sqlterminator cannot be alpha numeric.
?
?
舉例如下:
?
SQL> set sqlterminator off
SQL> show sqlterminator
sqlterminator OFF
SQL> select * from dual
? 2? ;
? 3? /
;
*
ERROR at line 2:
ORA-00911: invalid character
SQL> select * from dual
? 2? /
?
D
-
X
?
--關(guān)閉之后僅能以"/"來執(zhí)行該SQL語句
?
SQL> set sqlterminator on
SQL> show sqlterminator
sqlterminator ";" (hex 3b)
SQL> select * from dual
? 2? ;
?
D
-
X
?
--打開后默認(rèn)以";"來結(jié)尾
?
SQL> set sqlterminator !
SQL> show sqlterminator
sqlterminator "!" (hex 21)
SQL> select * from dual !
?
D
-
X
?
--設(shè)置其他字符作為sqlterminator
?
SQL> set sqlterminator on
SQL> show sqlterminator
sqlterminator ";" (hex 3b)
?
--設(shè)置on之后,依舊改為默認(rèn)結(jié)束代碼";"
?
SQL> set sqlterminator OFF
SQL> update T1
? 2? set A =
? 3? 'DECLARE
? 4? RID NUMBER := 0 ;
? 5? BEGIN
? 6? SELECT 1 INTO RID
? 7? FROM dual;
? 8? END ;'
? 9? where B= 'xxxx'
10? /
1 row updated.
SQL> commit
? 2? /
Commit complete.
SQL> set sqlterminator ON
?
--應(yīng)用(插入帶";"的字符串)
?
?
?
?
?
escape
?
SQLPLUS的escape參數(shù)后面可以跟4個(gè)東西,分別是ON、OFF、character和"\"
?
SQL> SET ESC[APE] {\| c|ON|OFF}
Defines the character you enter as the escape character. OFF undefinesthe escape character. ON enables the escape character. ON changes thevalue of c back to the default "\".
?
?
簡(jiǎn)單舉例:
?
SQL> set escape on
SQL> show escape
escape "\" (hex 5c)
SQL> select '\' from dual;
'
-
SQL> select '\\' from dual;
'
-
\
SQL> select '\\\' from dual;
'
-
\
SQL> select '\\\\' from dual;
'\
--
\\
?
--"\"為轉(zhuǎn)義符,轉(zhuǎn)移任意一個(gè)它后面的字符
?
SQL> set escape !
SQL> select '\\' from dual;
?
'\
--
\\
?
SQL> select '!\' from dual;
?
'
-
\
?
--使用其他字符作為轉(zhuǎn)義
?
?
?
注意:這里的escape參數(shù)與SQL中的escape函數(shù)完全不同
?
?
?