Insert Text Literal and Concatenation in Oracle SQL插入文本文字和級聯在甲骨文的SQL

In Oracle, it’s possible to insert literal or concatenate 2 or more charater strings or SQL result output together.在甲骨文,很可能要插入文字或串連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.兩個固體豎線| |運營商是用來串連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.旁邊,甲骨文公司還提供了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.甲骨文公司將自動進入人們的價值類型,可級聯。 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.正如甲骨文公司解釋空的空(零長度)字符串,它不會返回空,如果操作為NULL ,這意味著concatenating零長度字符串與另一運算結果總是在其他操作,因此無效只能產生從串連的兩個空字符串。 To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string.串連表達可能無效,使用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和僅限於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.尾隨空白字符串保存的串連,無論字符串'數據類型。

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 選擇若干| | ' -' | |述表的O RDERB Y人數

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 || ‘;’ 選擇'降型' | | type_name | | ' ; '

will generates:將產生:

DROP TYPE type_name降型type_name

that can be run at SQL*Plus by calling the file with @filename.可以運行的SQL *另外,呼籲該文件@文件名。 All types that been selected from first SQL statements will be dropped from the database.所有類型,被選為第一SQL語句將下降到數據庫中。

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 “Insert Text Literal and Concatenation in Oracle SQL”一個響應“插入文本文字和級聯在甲骨文的SQL ”

  1. Arun阿倫
    March 2nd, 2007 21:57 07年三月2日21時57
    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> 您可以使用這些標籤: href="" title="">的<a <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 concatenation 甲骨文串連 - - concatenation in oracle 在甲骨文串連 - - oracle concatenate 甲骨文串連 - - oracle sql concatenation 甲骨文的SQL串連 - - sql literal 數據庫字面 - - oracle sql concatenate 甲骨文的SQL串連 - - concat string oracle sql concat甲骨文的SQL字符串 - - oracle concat 甲骨文concat - - concatenation oracle 甲骨文串連 - - concatenation in oracle SQL 串連在甲骨文的SQL - - concatenate oracle 串連甲骨文 - - inserting formated text data in oracle table 插入格式文本數據在Oracle表 - - oracle concat null 甲骨文concat無效 - - sql oracle concatenate two strings 數據庫甲骨文串連兩串 - - oracle sql concatenate string 甲骨文的SQL字符串串連 - - what is concatenation in oracle 什麼是串連在甲骨文 - - concat oracle query concat甲骨文查詢 - - oracle concatenate text 甲骨文串連文字 - - ORACLE select concat 甲骨文選擇concat - - oracle concatenation 甲骨文串連 - - string concatenation oracle sql 字串串連甲骨文的SQL - - sqlplus concatenate sqlplus串連 - - string concatenation in oracle query 字串串連在Oracle查詢 - - adding a single quote in concat expression in oracle 增加了單引號中的表達concat甲骨文 - - concatenate oracle select statement 甲骨文公司選擇串連聲明 - - concat sql query concat SQL查詢 - - concatenate two string in oracle sql statement 串連兩個字符串在Oracle SQL語句 - - Concatenation+ORACLE 級聯+數據庫 - - concatination of strings in oracle concatination字符串甲骨文 - - concatenate queries oracle 串連查詢數據庫 - - concatenating queries in sql concatenating在SQL查詢 - - how to concatenate in oracle query 如何在Oracle串連查詢 - - Insert '-' between string in oracle 插入' -'弦之間在甲骨文 - - literals in sql query 文字在SQL查詢 - - literal in sql 在SQL字面 - - number and null concatenate oracel 數量和無效串連oracel - - oracle sql custom text 甲骨文的SQL自訂的文字 - - oracle pl/sql concatenate 甲骨文特等/數據庫串連 - - Oracle insert text file 甲骨文插入文本文件 - - oracle sql adding custom string to query result 甲骨文數據庫添加自定義字符串查詢結果 - - oracle sql concat empty 甲骨文的SQL concat空 - - ORA SQL select concatenate 奧拉的SQL選擇串連 - - oracle concat comments 甲骨文concat評論 - - oracle query concatenate phone number 甲骨文公司查詢電話號碼串連 - - sql insert literal in select 數據庫中插入文字選擇 - - sql string concatenation oracle SQL字符串串聯甲骨文 - - all 全部 - - concatenation in oracle sql statement 串連在甲骨文的SQL語句 - - concatenate pl string oracle 字串串連特等甲骨文 - - concat numbers in oracle concat甲骨文號碼 - -