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.これらの予約文字を含める_ (アンダースコア)は、これと' (または二重引用符)の値をマークするために使用さアポストロフィ任意の文字の0回以上の出現にマッチするために使用さ(パーセンテージ) %正確に1文字と一致するように使用されるワイルドカード文字を提供します。 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.これらの特殊文字を文字通りときにOracleのSQLクエリを構築し、解釈されません結果にエラーが発生することがありますが、特に文字列のLIKEキーワードで検索を実行戻った。 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 、文字通りのプリセットの代わりに文字列値の一部として意味を解釈することができますこれらの文字を使用するには、割り当てられた文字をエスケープする必要があります。
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. Oracleは、 Oracleでの予約文字に特別なエスケープ文字の割り当てを通常の文字は、文字通り、 ESCAPEキーワードを使用して解釈されて脱出することができますすることができます。
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 ‘\’; SELECTをguest_nameからのLIKE ' %名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; 『これが表示されます" " SELECTをダブル" "言葉を引用。 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 私のデジタルライフフォーラム . 。
Related Articles関連記事
- Manual and Clean Uninstall Oracle for Windows Oracleのマニュアルで清潔なアンインストールWindows用
- Oracle Database Link Oracleデータベースリンク
- Oracle Database Import Error 3113/3114 Oracleデータベースのインポートエラー3114分の3113
- Oracle JDeveloper Reviews OracleのJDeveloperレビュー
- Oracle PL/SQL ORA-00947 Not Enough Values Error OracleのPL / SQLののORA - 00947は十分な値のエラー
- Change Oracle Database User Password Oracleデータベースユーザーのパスワードを変更
- Check Oracle Version Oracleのバージョンを確認する
- IMP-00016 Required Character Set Conversion Not Supported Error when Import to Oracle Databaseインプ- 00016必要な文字セットの変換はサポートされているエラーがOracleデータベースにインポート
- Oracle Business Activity Monitoring Reviews Oracleのビジネスアクティビティモニタリングレビュー
- Insert Text Literal and Concatenation in Oracle SQLリテラル文字列を挿入し、連結オラクルでSQL

































July 13th, 2007 19:27 2007年7月13日19:27
[...] about Escape Characters.エスケープ文字[...] 。 Escape Characters Oracle Wildcards Wildcard Characters Escape Character How to Escape Characters in Oracle PL/SQL Queries Oracleのワイルドカードワイルドカード文字をエスケープ文字をエスケープ文字をどのようにOracleのPL / SQLのクエリの文字をエスケープする
September 17th, 2008 20:44 9月17日、 2008年20:44
salut j’ai le mm pb ! salut j'aiルミリ鉛! si je fait une recherche sur le ‘_’ seul sa marche mais si v je chercher des mots avec le ‘_’市帝フェイトune抜きのシュールル' _ 'のsaマルケ市情報seul Vの帝Chercher -シャルシェデm ots備えたル' _ '
exmple: exmple :
SELECT * from Test WHERE nom LIKE ‘1%\_%test’ ESCAPE ‘\’; * '1 %のテストのWHERE公称値のLIKEからのSELECT \ _ %テスト'避難口' \ ' ;
sa me renvoie :土メインrenvoie :
1_test
10_test ?? 10_testか?
or que normalement sa devait rendre que:またはしれませんnormalement土devait rendreしれません:
1_test ?? 1_testか?
je comprend pas帝comprendパ
September 26th, 2008 00:28 2008年9月26日00:28
Thank you very much - I’ma SQL Server gent with an Oracle source and I was going nuts!非常に多くの感謝-私はS QLS erverのゲントがO racleソースと、頭がおかしくなりそうだったよ!