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. ככל שניתן.
Related Articles מאמרים קשורים
- Insert Text Literal and Concatenation in Oracle SQL הכנס טקסט מילולי שרשור ב-Oracle ו-SQL
- Using Character Map (charmap) to Type and Input Special Characters and Accents in Windows Vista השימוש מפת תווים (charmap) את סוג קלט התווים המיוחדים ואת מבטאים ב-Windows Vista
- Oracle EXP-00091 Error When Export Database EXP-00091-Oracle שגיאה כאשר יצא מסד נתונים
- Remove or Trim First or Last Few Characters in MySQL Database with SQL הסרה או Trim ראשון או האחרונות תווים SQL עם מסד נתונים MySQL
- Firefox 3.1 Beta Smart Location Bar Enhancement: Special Characters to Restrict Searching & Smart Keyword to Search from Specific Website Firefox 3.1 Beta חכם בר שיפור מיקום: התווים המיוחדים להגביל חיפוש חכם & חיפוש מילת מפתח ספציפית מתוך האתר
- Check Oracle Version בדוק Oracle גירסה
- Change Oracle Database User Password שנה ל-Oracle Database משתמש סיסמה
- IMP-00016 Required Character Set Conversion Not Supported Error when Import to Oracle Database שובב-00016 נדרש התווים המרה אין תמיכה שגיאה כאשר יבוא אל Oracle Database
- ORA-01502 Oracle Index in Unusable State אורה-01502 ב-Oracle אינדקס המדינה לא שמיש
- You Are Not Authorized to Execute SQL Queries in vBulletin Maintenance אינך מורשה לבצע שאילתות SQL ב vBulletin תחזוקה










































September 26th, 2008 00:28 ספטמבר 26, 2008 00:28
Thank you very much - I'ma SQL Server gent with an Oracle source and I was going nuts! תודה רבה לך - I'ma SQL Server עם ג 'נטלמן של Oracle מקור ואני הולך משוגע!
September 17th, 2008 20:44 ספטמבר 17, 2008 20:44
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
July 13th, 2007 19:27 13 יולי 2007 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 שאילתות