How to Escape Characters in Oracle PL/SQL Queries如何轉義字符在Oracle PL / SQL的疑問

Oracle databases reserve some special characters with specific meaning and purpose within Oracle environment. Oracle數據庫儲備一些特殊字符與特定的含義和目的內部的Oracle環境。 These reserved characters include _ (underscore) wild card character which used to match exactly one character, % (percentage) which used to match zero or more occurrences of any characters and ‘ (apostrophe or quotation mark) which used to mark the value supplied.這些保留字符,包括_ (下劃線)外卡的特點,其中,用於匹配,正是一個字符, % (百分比) ,其中用於匹配零個或多個發生的任何字符和' (單引號或引號) ,用來標誌提供的值。 These special characters will not be interpreted literally when building SQL query in Oracle, and may caused error in results returned especially when performing string search with LIKE keyword.這些特殊字符將不會字面解釋時,建設SQL查詢在Oracle中,並可能造成的錯誤,在返回的結果,尤其是當表演字符串搜索與關鍵字一樣。 To use these characters so that Oracle can interpret them literally as a part of string value instead of preset mean, escape character has to be assigned.使用這些字符,使甲骨文公司可以解釋他們在字面上的一個組成部分字符串值,而不是預設的意思是,轉義字符已經被指派。

Oracle allows the assignment of special escape characters to the reserved characters in Oracle can be escaped to normal characters that is interpreted literally, by using ESCAPE keyword.甲骨文允許轉讓特別轉義字符,以保留字在甲骨文可以逃脫正常的字符是字面解釋,利用逃生的關鍵字。

For example, to select the name of guests with _ (underscore) in it, use the following statement:舉例來說,選擇的名稱,客人與_ (下劃線)在它,使用以下聲明:

SELECT guest_name FROM guest_table WHERE name LIKE ‘%\_%’ ESCAPE ‘\’;選擇guest_name從guest_table那裡的名稱一樣, ' % \ _ % '逃生' \ ' ;

Without specifying the \ (backslash) as escape clause, the query will return all guest names, making the unwanted results problem.沒有具體說明\ (反斜線)作為免責條款,查詢將返回所有客戶的名稱,使不想要的結果的問題。

The above syntax will not work on ‘ (quote).上述語法將不會工作, ' (引) 。 To escape this quotation mark and to display the quote literally in string, insert another quote (total 2 quotes) for every quote that want to be displayed.要擺脫這種引號,並顯示引述從字面上來看,在字符串,插入另一引號(共計2引號)為每引述說,要顯示的。 For example:例如:

SELECT ‘This will display line with quote’’s word.’ FROM temp_table;選擇' ,這將顯示符合quote'的話。 '從temp_table ;
SELECT ‘This will display ””double quoted”” word.’ FROM temp_table;選擇' ,這將顯示“ , ”雙引述“ ”字。 '從temp_table ;

will return the following respectively:將返回以下分別是:

This will display line with quote’s word.這將顯示器產品線引的話。
This will display ”double quoted” word.這會顯示“雙引述”字。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article英文原版的文章 whenever possible.只要有可能。

Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 .



One Response to “How to Escape Characters in Oracle PL/SQL Queries” 1回應“如何轉義字符在Oracle PL / SQL的疑問”

  1. Escape Character in MySql - Discussweb IT Community - Web Development, Software Programming, SEO, Quality Assurance, 3D, Web Hosting and more...轉義字符在MySQL -d iscusswebI T社區- We b開發,軟件編程,徐,品質保證,三維,網站託管和更多.. .
    July 13th, 2007 19:27 2007年7月13日19時27分
    1

    [...] about Escape Characters. [ … … ]關於轉義字符。 Escape Characters Oracle Wildcards Wildcard Characters Escape Character How to Escape Characters in Oracle PL/SQL Queries轉義字符甲骨文通配符通配符字符轉義字符如何轉義字符在Oracle PL / SQL的疑問

Leave a Reply離開的答复

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> 您可以使用這些標籤:的<a href="" title=""> <abbr title=""> <acronym title="">的<b> <blockquote cite=""> <cite>的<code> <刪除日期時間= “ ” >的<em>的<i> <q cite=""> <strike>的<strong>

Subscribe without commenting訂閱無評論


Custom Search

New Articles新的條款,

Incoming Search Terms for the Article傳入的搜索條件文章

oracle escape character 甲骨文轉義字符 - - sql escape character 的SQL轉義字符 - - oracle escape 甲骨文逃生 - - oracle sql escape 甲骨文的SQL逃生 - - oracle escape characters 甲骨文轉義字符 - - pl/sql escape character PL / SQL的轉義字符 - - oracle sql escape character 甲骨文的SQL轉義字符 - - oracle escape & 甲骨文逃生& - - sql escape 的SQL逃生 - - plsql escape plsql逃生 - - oracle escape apostrophe 甲骨文逃生撇號 - - escape character in oracle 轉義字符在Oracle - - oracle escape quote 甲骨文逃生報價 - - pl sql escape character 臨時立法會的SQL轉義字符 - - oracle escape char 甲骨文逃生煤焦 - - escape character oracle 轉義字符甲骨文 - - sql escape characters 的SQL轉義字符 - - escape character in PL/SQL 轉義字符在PL / SQL的 - - escape characters in Oracle 轉義字符在Oracle - - escape character in sql 轉義字符在SQL - - oracle escape character ' 甲骨文轉義字符' - - pl/sql escape PL / SQL的逃生 - - oracle string escape 甲骨文字符串逃生 - - oracle sql escape characters 甲骨文的SQL轉義字符 - - escape characters in SQL 轉義字符在SQL - - SQL escape char 燒焦的SQL逃生 - - pl/sql escape characters PL / SQL的轉義字符 - - pl/sql escape & PL / SQL的逃生& - - plsql escape character plsql轉義字符 - - plsql escape characters plsql轉義字符 - - oracle sql escape & 甲骨文的SQL逃生& - - oracle escaping ' 甲骨文擺脫' - - escape character pl/sql 轉義字符PL / SQL的 - - oracle escape string 甲骨文逃生字符串 - - sql reserved characters 的SQL保留字符 - - escape in oracle 在Oracle中逃生 - - Escaping & in sql 逃離&在SQL - - escaping & in oracle 逃離&在Oracle - - pl sql escape characters 臨時立法會的SQL轉義字符 - - escape characters sql 轉義字符的SQL - - Oracle SQL escape 甲骨文的SQL逃生 - - oracle sql escape char 甲骨文的SQL逃生煤焦 - - oracle escaping 甲骨文逃逸 - - ORACLE plsql escape 甲骨文plsql逃生 - - escape character sql 轉義字符的SQL - - plsql escape char plsql逃生煤焦 - - SQL escape quote 逃生的SQL報價 - - escape sql 逃生的SQL - - ESCAPE CHARACTERS ORACLE 轉義字符甲骨文 - - oracle escape ' 甲骨文逃生' - -