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. אלה כוללות שמורות תווים _ (קו תחתון) פראי כרטיס התווים שבה השתמשת כדי להתאים בדיוק אופי,% (אחוז) בהם נעשה שימוש כדי להתאים אפס או יותר מופעים של כל התווים ו '(או מרכה apostrophe) בהם נעשה שימוש כדי לסמן את הערך שסופק. 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, וייתכן כי גרם שגיאה בתוצאות חזר במיוחד כאשר ביצועים 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 מאפשר הקצאה של תווים מיוחדים להימלט אל שמורות תווים אורקל יכול להיות ברח כדי תווים כי בדרך כלל הוא לפרש פשוטו כמשמעו, באמצעות מילות מפתח בריחה.

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 FROM 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.' בחר 'זה יציג שורה עם quote' של המילה'. FROM temp_table; FROM temp_table;
SELECT 'This will display ””double quoted”” word.' בחר 'זה יציג "" מצוטט כפולה "" המילה'. FROM temp_table; FROM temp_table;

will return the following respectively: תחזיר את הבאים בהתאמה:

This will display line with quote's word. זה יציג שורה עם ציטוט של המילה.
This will display ”double quoted” word. זה יציג "כפול מצוטט" Word.

IMPORTANT : The page is machine translated and provided "as is" without warranty. חשוב: הדף הוא מכונה בתרגום ובתנאי "כמות שהוא", ללא אחריות. Machine translation may be difficult to understand. תרגום מכונה יכול להיות קשה להבין. Please refer to אנא פנה ל original English article המאמר המקורי באנגלית whenever possible. ככל שניתן.


3 Responses to “How to Escape Characters in Oracle PL/SQL Queries” 3 תגובות ל "איך לברוח תווים Oracle PL / SQL השאילתות"

  1. Charles Asbornsen צ 'רלס Asbornsen
    September 26th, 2008 00:28 ספטמבר 26, 2008 00:28
    3 3

    Thank you very much - I'ma SQL Server gent with an Oracle source and I was going nuts! תודה רבה לך - I'ma SQL Server עם ג 'נטלמן של Oracle מקור ואני הולך משוגע! :)

  2. sam33 sam33
    September 17th, 2008 20:44 ספטמבר 17, 2008 20:44
    2 2

    salut j'ai le mm pb ! salut j'ai Le pb מ"מ! si je fait une recherche sur le '_' seul sa marche mais si v je chercher des mots avec le '_' si je fait une משוכלל ונדיר sur le '_' seul sa marche mais si je V chercher des mots avec le '_'
    exmple: exmple:
    SELECT * from Test WHERE nom LIKE '1%\_%test' ESCAPE '\'; * בחר מתוך בדיקה איפה Nom LIKE'1% \ _% הבדיקה 'בריחה' \ ';
    sa me renvoie : sa renvoie אותי:
    1_test 1_test
    10_test ?? 10_test??
    or que normalement sa devait rendre que: או normalement que sa devait rendre que:
    1_test ?? 1_test??
    je comprend pas je comprend pas

  3. Escape Character in MySql - Discussweb IT Community - Web Development, Software Programming, SEO, Quality Assurance, 3D, Web Hosting and more... בריחה תו MySQL ב - IT Discussweb קהילה - אינטרנט פיתוח תוכנה תכנות, SEO, אבטחת איכות, 3D, אירוח אתרים ועוד ...
    July 13th, 2007 19:27 13 יולי 2007 19:27
    1 1

    [...] about Escape Characters. [...] עוד על בריחה תווים. Escape Characters Oracle Wildcards Wildcard Characters Escape Character How to Escape Characters in Oracle PL/SQL Queries דמויות בריחה Oracle בתווים כלליים בתווים כלליים בריחה תו איך לברוח תווים 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> <דל datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. הצטרף כמנוי ל הערות תכונה הושבת. To receive notification of latest comments posted, subscribe to כדי לקבל הודעה על תגובות העדכנית פורסם, כדי להירשם My Digital Life Comments RSS feed החיים שלי דיגיטלי תגובות RSS Feed or או register to receive הרשמה לקבלת new comments in daily email digest. תגובות חדש ב דוא"ל תקציר יומי.
Custom Search

New Articles מאמרים חדשים

Incoming Search Terms for the Article חיפוש נכנס על תנאי סעיף

oracle escape Oracle לברוח - -- oracle escape character Oracle לברוח אופי - -- pl sql escape character PL SQL לברוח אופי - -- escape character in oracle לברוח אופי של Oracle - -- oracle escape characters Oracle לברוח תווים - -- escape oracle לברוח Oracle - -- sql escape & SQL & לברוח - -- sql escape SQL לברוח - -- sql escape character SQL לברוח אופי - -- oracle escape & Oracle & לברוח - -- oracle escape string Oracle לברוח מחרוזת - -- oracle sql escape Oracle SQL לברוח - -- sql escape apostrophe SQL לברוח apostrophe - -- oracle apostrophe escape Oracle apostrophe לברוח - -- sql escape ' SQL לברוח ' - -- escape character in pl sql לברוח התווים ב PL SQL - -- all הכל - -- oracle escape quote Oracle לברוח ציטוט - -- Escape in Oracle בריחה ב-Oracle - -- oracle escape ' Oracle לברוח ' - -- how to escape & in oracle איך לברוח & ב Oracle - -- oracle escaping & Oracle & escaping - -- oracle ' escape Oracle 'לברוח - -- pl sql escape PL SQL לברוח - -- pl sql escape single quote PL SQL לברוח יחיד ציטוט - -- escape sequence oracle sql לברוח רצף Oracle SQL - -- ORACLE LIKE ESCAPE Oracle LIKE בריחה - -- pl/sql escape character PL / SQL לברוח אופי - -- oracle sql & character Oracle SQL & אופי - -- escape character in PL/SQL לברוח התווים ב PL / SQL - -- escape sql oracle לברוח Oracle SQL - -- oracle escape char Oracle לברוח char - -- oracle sql escape sequence Oracle SQL לברוח ברצף - -- oracle escape apostrophe Oracle לברוח apostrophe - -- using escape in oracle השימוש ב-Oracle לברוח - -- escape & in sql לברוח & ב SQL - -- escape character oracle לברוח אופי Oracle - -- plsql escape quote plsql לברוח ציטוט - -- oracle sql character Oracle SQL אופי - -- escape character pl/sql לברוח אופי PL / SQL - -- escape char in pl/sql לברוח char ב PL / SQL - -- inserting special characters in oracle הוספת תווים מיוחדים Oracle - -- pl/sql escape & PL / SQL & לברוח - -- escaping & in oracle escaping & ב Oracle - -- escape ' in oracle בריחה 'של Oracle - -- how to escape ' in oracle איך לברוח 'ב Oracle - -- pl sql escape PL SQL לברוח - -- oracle & escape character Oracle & לברוח אופי - -- oracle quote escape Oracle ציטוט לברוח - -- ORACLE CHARACTER & Oracle & אופי - --