Decode360's Blog

          業(yè)精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
            397 隨筆 :: 33 文章 :: 29 評論 :: 0 Trackbacks
          sqlterminator
          ?
          ?
          SQLPLUS的sqlterminator參數(shù)可以在后面跟3個東西,分別是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
          ?
          --打開后默認以";"來結(jié)尾
          ?
          SQL> set sqlterminator !
          SQL> show sqlterminator
          sqlterminator "!" (hex 21)
          SQL> select * from dual !
          ?
          D
          -
          X

          ?
          --設置其他字符作為sqlterminator
          ?
          SQL> set sqlterminator on
          SQL> show sqlterminator
          sqlterminator ";" (hex 3b)
          ?
          --設置on之后,依舊改為默認結(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
          ?
          --應用(插入帶";"的字符串)
          ?
          ?
          ?

          ?
          ?
          escape

          ?
          SQLPLUS的escape參數(shù)后面可以跟4個東西,分別是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 "\".
          ?
          ?
          簡單舉例:
          ?
          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)移任意一個它后面的字符
          ?
          SQL> set escape !
          SQL> select '\\' from dual;
          ?
          '\
          --
          \\
          ?
          SQL> select '!\' from dual;
          ?
          '
          -
          \
          ?
          --使用其他字符作為轉(zhuǎn)義
          ?
          ?
          ?
          注意:這里的escape參數(shù)與SQL中的escape函數(shù)完全不同
          ?
          ?
          ?
          posted on 2009-03-30 21:54 decode360 閱讀(310) 評論(0)  編輯  收藏 所屬分類: 05.SQL
          主站蜘蛛池模板: 梧州市| 临颍县| 都匀市| 苏尼特左旗| 土默特左旗| 临清市| 乌什县| 浦江县| 镇远县| 鄯善县| 杭锦旗| 泊头市| 山西省| 旌德县| 繁昌县| 滕州市| 昌图县| 池州市| 交城县| 八宿县| 桐城市| 平陆县| 德保县| 姜堰市| 昆明市| 嘉兴市| 大关县| 东阳市| 中山市| 阜城县| 兴国县| 桐梓县| 宜兰市| 安福县| 商丘市| 岑溪市| 仁化县| 富源县| 江津市| 孝感市| 大荔县|