set define off ——插入特殊字元,如&

來源:互聯網
上載者:User
在插入資料遇到&時,oracle會認為是個變數,要求輸入值。 原因在於oracle將&定義為自訂變數。SQL> show all   
appinfo is OFF and set to "SQL*Plus"
arraysize 15
autocommit OFF
autoprint OFF
autorecovery OFF
autotrace OFF
blockterminator "." (hex 2e)
btitle OFF and is the first few characters of the next SELECT statement
cmdsep OFF
colsep " "
compatibility version NATIVE
concat "." (hex 2e)
copycommit 0
COPYTYPECHECK is ON
define "&" (hex 26)
describe DEPTH 1 LINENUM OFF INDENT ON
echo OFF
editfile "afiedt.buf"
embedded OFF
escape OFF
escchar OFF
...... 此時只要set define off,即可插入包含&的值。Using the SET DEFINE OFF Command

To avoid the prompt in the preceding example by using the SET DEFINE OFF command, change the entry to the following:

SET DEFINE OFFCREATE TABLE "Employees & Managers" (    Employees varchar(16),     Managers varchar(16));

SET DEFINE OFF

SET DEFINE OFF disables the parsing of commands to replace
substitution variables with their values.

注意:如果是在TOAD中執行,建議在每一個要匯入的指令碼第一行加上前面那句關閉define的話,否則當你匯入第二個含有特殊字元的指令碼的時候,又會出錯。
        如果是在SQL*PLUS中執行,則只需要設定一次define OFF,後面就可以連續匯入了。直到你重新設定define ON為止。






聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.