Insert Text Literal and Concatenation in Oracle SQL הכנס טקסט מילולי שרשור ב-Oracle ו-SQL

In Oracle, it's possible to insert literal or concatenate 2 or more charater strings or SQL result output together. ב-Oracle, אפשר להכניס CONCATENATE מילולי או 2 או יותר או charater מחרוזות SQL התוצאה פלט יחד. This manipulation allows you to manipulate the format of data returned by SQL query. זה מאפשר לך מניפולציה כדי לתפעל את הפורמט של נתונים שהחזיר שאילתת SQL.

Two solid vertical bar || operator is used to concatenate 2 or more strings. שני בר סולידי אנכי | | מפעיל משמש CONCATENATE 2 או יותר מחרוזות. Beside, Oracle also provides the CONCAT character function as an alternative to the vertical bar operator just in case there is situation where it is difficult or impossible to control translation performed by operating system or network utilities. לצד, Oracle מספקת גם את אופי CONCAT לתפקד כחלופה ל ניצב בר מפעיל רק במקרה שיש מצב שבו קשה או בלתי אפשרי לשלוט תרגום שמתבצע על ידי מערכת ההפעלה או רשת כלי עזר. This function should be used in applications that will be moved between environments with differing character sets. פונקציה זו יש להשתמש ביישומים אשר יועברו בין סביבות שונות עם אופי קובע.

Oracle will automatically casts values into types which can be concatenated. Oracle באופן אוטומטי מטיל לתוך סוגי ערכים אשר יכולים להיות concatenated. As Oracle interprets NULL as the empty (zero-length) character string, it doesn't return NULL if an operand is NULL, meaning concatenating a zero-length character string with another operand always results in the other operand, so null can result only from the concatenation of two null strings. כמו Oracle מפרש ריק כמו ריקה (אפס אורך) מחרוזת התווים, זה לא לחזור ריק אם operand הוא ריק, כלומר אפס concatenating א אורך מחרוזת התווים עם עוד operand תמיד התוצאות האחרות operand, כך ריק יכולים רק תוצאה מתוך שרשור של שתי מחרוזות ריק. To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string. כדי CONCATENATE ביטוי שעשוי להיות ריק, יש להשתמש בפונקציה NVL במפורש כדי להמיר את הביטוי של אפס אורך מחרוזת.

Concatenating two strings results in another character string. שתי תוצאות Concatenating מחרוזות אחר מחרוזת התווים. If both character strings are of datatype CHAR, the result has datatype CHAR and is limited to 2000 characters. אם שני התווים הם מחרוזות של char נתון, התוצאה היא נתון char ומוגבלת ל 2000 תווים. If either string is of datatype VARCHAR2, the result has datatype VARCHAR2 and is limited to 4000 characters. גם אם הוא מחרוזת של VARCHAR2 נתון, התוצאה היא נתון VARCHAR2 ומוגבלת ל 4000 תווים. Trailing blanks in character strings are preserved by concatenation, regardless of the strings' datatypes. כדורי סרק נגרר אופי מחרוזות נשמרים על ידי שרשור, ללא תלות מחרוזות 'datatypes.

For literal insertion, put the strings between the single quote ' in the SQL statement. עבור החדרת מילולי, לשים את מחרוזות בין הצעת מחיר אחת 'על הצהרת SQL.

Example and Usage : דוגמה וקווי:

SELECT 'Name is ' || name FROM table; בחר ב 'שם' | | שם שולחן;

Name is whatever_name שם הוא whatever_name

SELECT number || ' - ' || description FROM table ORDER BY number בחר מספר | | '-' | | תיאור שולחן FROM הזמנה לפי מספר

1 - description 1 1 - 1 תיאור
2 - description 2 2 - 2 תיאור

Advance Usage : שימוש מתקדם:

It's possible to use Concatenation and Literal Insertion to generate a set of SQL query language automatically, especially when need to perform same operation to lots of tables, ie dropping a lot of tables. ניתן להשתמש שרשור ו מילולי ההכנסה כדי ליצור קבוצה של שאילתת SQL שפה באופן אוטומטי, במיוחד כאשר צריך לבצע אותה פעולה על הרבה שולחנות, כלומר נטיפה הרבה שולחנות. To do this, format the SQL data query language to output the query result in valid SQL format, and spool the SQL query results to a file. לשם כך, מבנה נתונים של SQL שאילתת השפה פלט את שאילתת SQL לגרום חוקי הפורמט, ו אשוה שאילתת SQL את התוצאות לקובץ. Then execute the file that contains SQL statements. לאחר מכן להפעיל את הקובץ אשר מכיל הצהרות של SQL.

Example: דוגמה:

SELECT 'DROP TYPE ' || type_name || ';' בחר 'סוג DROP' | | type_name | | ';'

will generates: יהיה יוצר:

DROP TYPE type_name DROP סוג type_name

that can be run at SQL*Plus by calling the file with @filename. כי ניתן להפעיל ב-SQL * Plus על ידי קורא את הקובץ עם @ שם הקובץ. All types that been selected from first SQL statements will be dropped from the database. כל סוגי נבחרת מ SQL תוחודל הראשונה תהיה ירד מ הנתונים.

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. ככל שניתן.


One Response to “Insert Text Literal and Concatenation in Oracle SQL” תגובה אחת ל "הכנס טקסט מילולי שרשור ב-Oracle ו-SQL"

  1. Arun Arun
    March 2nd, 2007 21:57 2 במרץ, 2007 21:57
    1 1

    Good article. מאמר טוב. Got what I was looking for… יש לך את מה שאני מחפש ...

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 concatenation Oracle שרשור - -- sql literal SQL literal - -- sqlplus concat sqlplus concat - -- oracle sql concatenate Oracle SQL CONCATENATE - -- oracle concat null Oracle concat ריק - -- oracle concatenate text Oracle CONCATENATE טקסט - -- concatenation in oracle sql שרשור ב-Oracle SQL - -- oracle query string concatenation Oracle מחרוזת שאילתה שרשור - -- sqlplus concatenate sqlplus CONCATENATE - -- oracle concatenate char 4000 Oracle CONCATENATE להשחיר 4000 - -- concatenate sql oracle CONCATENATE Oracle SQL - -- concatenating strings in oracle concatenating מחרוזות ב-Oracle - -- insert 2 characters in sql field הכנס 2 תווים SQL שדה - -- oracle SELECT LITERAL Oracle בחר מילולי - -- concatenate oracle sql CONCATENATE Oracle SQL - -- Oracle SQL functions concatenate Oracle SQL פונקציות CONCATENATE - -- concatenation oracle sql שרשור Oracle SQL - -- oracle insert concat Oracle הכנס concat - -- oracle concat Oracle concat - -- sqlplus insert spanish characters הכנס תווים sqlplus ספרדית - -- sqlplus concatenate string sqlplus CONCATENATE מחרוזת - -- oracle string concatenation sql שרשור מחרוזת Oracle SQL - -- oracle sql string concatenation Oracle SQL מחרוזת שרשור - -- concatenate string sql oracle CONCATENATE מחרוזת SQL Oracle - -- oracle concatenate string char Oracle CONCATENATE מחרוזת char - -- oracle sql literal Oracle SQL מילולי - -- concatenation oracle שרשור Oracle - -- concat in oracle sql concat ב Oracle SQL - -- oracle sql plus query concatenate Oracle SQL Plus שאילתה CONCATENATE - -- sqlplus concatenation sqlplus שרשור - -- concat oraclesample query concat oraclesample שאילתה - -- adding a literal to sql statement הוספת מילולי ל-SQL הצהרה - -- concatenate text with returned values in oracle טקסט CONCATENATE חזר עם ערכים Oracle - -- literal & oracle toad מילולי & Oracle קרפדה - -- oracle sql concatenation Oracle SQL שרשור - -- pl/sql optimization append string PL / SQL אופטימיזציה צירוף מחרוזת - -- sql CONCATENATE space ORACLE Oracle SQL CONCATENATE שטח - -- sqlplus insert a string with french char sqlplus הכנס מחרוזת צרפתית עם char - -- sql oracle concatenar variable a query Oracle SQL concatenar משתנה שאילתה - -- concatenate number and character in oracle CONCATENATE מספר התווים של Oracle - -- INSERTING TEXT INTO SELECT STATEMENTS IN SQL הוספת טקסט לתוקף בחר דברים ב-SQL - -- inserting text format oracle הוספת טקסט בתבנית Oracle - -- oracle literal concat Oracle מילולי concat - -- oracle update statement with concatenate quotes Oracle עדכון הצהרה CONCATENATE עם מרכאות - -- oracle concatenation number Oracle מספר שרשור - -- oracle varchar concatener Oracle varchar concatener - -- oracle concatenate string format Oracle CONCATENATE מחרוזת הפורמט - -- ORACLE SQL QUERY HOW TO INSERT SINGLE QUOTE IN FIELD DATA Oracle שאילתת SQL איך להכניס SINGLE Quote בתחום נתונים - -- sql insert character ' part of name SQL להכניס תו 'חלק שם - -- string concatenation oracle sql שרשור מחרוזת Oracle SQL - --