Insert Text Literal and Concatenation in Oracle SQL Chèn văn bản từng chữ và trong Concatenation Oracle SQL

In Oracle, it's possible to insert literal or concatenate 2 or more charater strings or SQL result output together. Trong Oracle, có thể chèn thêm các literal concatenate hoặc 2 hoặc nhiều hơn charater strings SQL hoặc kết quả đầu ra lại với nhau. This manipulation allows you to manipulate the format of data returned by SQL query. Thao tác này cho phép bạn thao tác định dạng dữ liệu trả về của truy vấn SQL.

Two solid vertical bar || operator is used to concatenate 2 or more strings. Hai rắn dọc thanh | | nhà điều hành được sử dụng để concatenate strings 2 hoặc nhiều hơn. 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. Bên cạnh, Oracle cũng cung cấp các chức năng CONCAT ký tự như là một lựa chọn thay thế dọc quầy bar nhà điều hành, trong trường hợp chỉ có nơi đó là tình hình khó khăn hoặc không thể kiểm soát dịch thực hiện bởi hệ điều hành hoặc tiện ích mạng. This function should be used in applications that will be moved between environments with differing character sets. Chức năng này nên được sử dụng trong các ứng dụng đó sẽ được di chuyển giữa các môi trường khác nhau với các ký tự đặt ra.

Oracle will automatically casts values into types which can be concatenated. Oracle sẽ tự động casts giá trị vào loại này có thể được 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 là dịch như là trống rỗng, Null (không dài) chuỗi ký tự, không trả lại nếu một Null operand là Null, có nghĩa là một số không concatenating dài chuỗi ký tự khác với operand luôn luôn kết quả trong operand khác, do đó, kết quả chỉ có thể null từ concatenation của hai null strings. To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string. Để concatenate một biểu rằng có thể là null, NVL sử dụng các chức năng để chuyển đổi rõ ràng những biểu cho một số không dài chuỗi.

Concatenating two strings results in another character string. Concatenating hai strings kết quả trong một chuỗi ký tự. If both character strings are of datatype CHAR, the result has datatype CHAR and is limited to 2000 characters. Nếu cả hai ký tự strings đang có dư liệu của Char, kết quả có dư liệu Char và được giới hạn trong 2000 ký tự. If either string is of datatype VARCHAR2, the result has datatype VARCHAR2 and is limited to 4000 characters. Nếu một trong hai chuỗi là của dư liệu VARCHAR2, kết quả có dư liệu VARCHAR2 và được giới hạn trong 4000 ký tự. Trailing blanks in character strings are preserved by concatenation, regardless of the strings' datatypes. Trailing blanks trong strings ký tự được bảo tồn của concatenation, bất kể strings' datatypes.

For literal insertion, put the strings between the single quote ' in the SQL statement. Đối với từng chữ chèn, đưa strings giữa các đơn báo giá 'trong SQL statement.

Example and Usage : Ví dụ và Cách sử dụng:

SELECT 'Name is ' || name FROM table; CHỌN 'Tên là' | | TỪ bảng tên;

Name is whatever_name Tên là whatever_name

SELECT number || ' – ' || description FROM table ORDER BY number CHỌN số | | '-' | | bảng mô tả TỪ ĐẶT HÀNG THEO số

1 – description 1 1 - mô tả 1
2 – description 2 2 - mô tả 2

Advance Usage : Nâng cao Cách sử dụng:

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. Có thể sử dụng và Concatenation literal Chen để tạo ra một bộ các truy vấn SQL sẽ tự động ngôn ngữ, đặc biệt là khi cần phải thực hiện cùng một hoạt động rất nhiều để bàn, tức là giảm rất nhiều bàn. 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. Để làm điều này, các định dạng dữ liệu SQL truy vấn ngôn ngữ để sản xuất các kết quả truy vấn SQL trong định dạng hợp lệ, và spool các truy vấn SQL kết quả vào một tập tin. Then execute the file that contains SQL statements. Sau đó, thực hiện các tập tin có chứa SQL kê.

Example: Ví dụ:

SELECT 'DROP TYPE ' || type_name || ';' CHỌN 'thả LOẠI' | | type_name | | ';'

will generates: sẽ tạo ra:

DROP TYPE type_name Thả LOẠI type_name

that can be run at SQL*Plus by calling the file with @filename. có thể được chạy vào lúc SQL * Plus bằng cách gọi các tập tin với tên tập tin @. All types that been selected from first SQL statements will be dropped from the database. Tất cả các loại hình đó được lựa chọn từ SQL kê đầu tiên sẽ được tụt xuống từ cơ sở dữ liệu.

IMPORTANT : The page is machine translated and provided "as is" without warranty. Lưu ý: Các trang web là máy tính dịch và cung cấp "như là" mà không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể là khó hiểu. Please refer to Xin vui lòng tham khảo original English article Tiếng Anh bản gốc bài viết whenever possible. bất cứ khi nào có thể.


One Response to “Insert Text Literal and Concatenation in Oracle SQL” Một trong những đáp ứng cho "Chèn văn bản literal và Concatenation Oracle trong SQL"

  1. Arun Arun
    March 2nd, 2007 21:57 2 tháng ba, 2007 21:57
    1 1

    Good article. Giải bài báo. Got what I was looking for… Có những gì tôi đã được tìm kiếm ...

Leave a Reply Để lại một trả lời

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> Bạn có thể sử dụng các thẻ:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Đăng ký nhận xét tính năng đã bị vô hiệu hoá. To receive notification of latest comments posted, subscribe to Để nhận được thông báo về ý kiến mới nhất được đăng, đăng ký với My Digital Life Comments RSS feed Cuộc sống kỹ thuật số Bình luận của tôi nguồn cấp dữ liệu RSS or hoặc register to receive đăng ký để nhận được new comments in daily email digest. Các ý kiến mới trong thư điện tử tiêu hàng ngày.
Custom Search

New Articles Bài viết mới

Incoming Search Terms for the Article Tìm kiếm các điều khoản cho các Điều

oracle concatenation oracle concatenation - -- oracle sql concatenate oracle sql concatenate - -- sqlplus concat sqlplus concat - -- sql literal sql literal - -- concatenation in oracle sql concatenation trong oracle sql - -- sqlplus concatenate string sqlplus concatenate chuỗi - -- concatenate sql oracle concatenate sql oracle - -- oracle query string concatenation oracle yêu cầu concatenation - -- Concatenation in oracle Concatenation trong oracle - -- SQL literal string SQL literal chuỗi - -- oracle sql literal oracle sql literal - -- Oracle query concatenate Oracle yêu cầu tìm kiếm concatenate - -- sqlplus concatenate sqlplus concatenate - -- oracle select concat oracle chọn concat - -- oracle query concat oracle truy vấn concat - -- oracle sql string concatenation oracle sql string concatenation - -- concat in oracle sql concat trong oracle sql - -- how to concatenation with the value in oracle query làm thế nào để concatenation với các giá trị trong oracle truy vấn - -- oracle concat null oracle concat null - -- oracle concatenate text oracle concatenate văn bản - -- concatenate in oracle sql concatenate trong oracle sql - -- concatenation oracle sql concatenation oracle sql - -- Oracle SQL Concatenation operator Oracle SQL Concatenation nhà điều hành - -- concatenation oracle concatenation oracle - -- oracle concat text oracle concat văn bản - -- oracle SELECT LITERAL oracle CHỌN literal - -- concatenate string sql oracle concatenate chuỗi sql oracle - -- oracle sql concatenate text from several records oracle sql concatenate văn bản từ một số hồ sơ - -- concatenating strings in oracle concatenating strings trong oracle - -- oracle concatenation in sql oracle concatenation trong sql - -- oracle text concatenation oracle concatenation văn bản - -- oracle concat oracle concat - -- sqlplus concatenation sqlplus concatenation - -- string concat in oracle sql string concat trong oracle sql - -- concat Oracle SQL concat Oracle SQL - -- oracle sql concatenation oracle sql concatenation - -- concatenate oracle sql concatenate oracle sql - -- concatenate oracle select concatenate oracle chọn - -- oracle select concat string oracle chọn concat chuỗi - -- concat query result oracle concat truy vấn kết quả oracle - -- oracle concatenate char 4000 oracle concatenate xe 4000 - -- sql insert concatenate sql chèn concatenate - -- concat oracle concat oracle - -- oracle string concatenation null oracle concatenation chuỗi null - -- ORACLE concatenate ORACLE concatenate - -- string concatenation in oracle string concatenation trong oracle - -- all tất cả - -- oracle select string literal oracle chọn string literal - -- concatenate strings in oracle sql concatenate strings trong oracle sql - -- oracle concatenate null oracle concatenate null - --