Insert Text Literal and Concatenation in Oracle SQL Masukkan Teks Literal dan rentetan dalam Oracle SQL
In Oracle, it's possible to insert literal or concatenate 2 or more charater strings or SQL result output together. Dalam Oracle, mungkin untuk memasukkan literal atau menyatukan 2 atau lebih charater string SQL atau hasil keluaran bersama. This manipulation allows you to manipulate the format of data returned by SQL query. Manipulasi ini memungkinkan Anda untuk memanipulasi data format dikembalikan oleh SQL query.
Two solid vertical bar || operator is used to concatenate 2 or more strings. Solid dua bar vertikal | | operator digunakan untuk menggabungkan 2 atau lebih string. 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. Disamping, Oracle juga menyediakan CONCAT karakter berfungsi sebagai alternatif dari vertikal bar operator hanya dalam kasus dimana terdapat situasi sulit atau mustahil untuk mengendalikan terjemahan dilakukan oleh sistem operasi atau jaringan utilitas. This function should be used in applications that will be moved between environments with differing character sets. Fungsi ini harus digunakan dalam aplikasi yang akan dipindahkan antara lingkungan yang berbeda dengan rangkaian karakter.
Oracle will automatically casts values into types which can be concatenated. Oracle akan secara otomatis membuat nilai menjadi jenis yang dapat 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 sebagai menafsirkan NULL sebagai kosong (nol-panjang) karakter string, ia tidak kembali jika operand NULL adalah NULL, yang berarti concatenating nol-string dengan panjang karakter lain operand selalu hasil yang lainnya operand, jadi hanya dapat menghasilkan null dari rangkaian dua null string. To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string. Untuk menyatukan kalimat yang mungkin null, menggunakan fungsi NVL secara eksplisit mengkonversi ekspresi ke nol-panjang string.
Concatenating two strings results in another character string. String hasil Concatenating dua karakter dalam string lain. If both character strings are of datatype CHAR, the result has datatype CHAR and is limited to 2000 characters. Jika kedua karakter string adalah data CHAR, hasilnya memiliki data CHAR dan dibatasi hingga 2000 karakter. If either string is of datatype VARCHAR2, the result has datatype VARCHAR2 and is limited to 4000 characters. Jika salah satu dari string adalah data VARCHAR2, hasilnya telah VARCHAR2 datatype dan dibatasi hingga 4000 karakter. Trailing blanks in character strings are preserved by concatenation, regardless of the strings' datatypes. Trailing kosong di string karakter yang diawetkan oleh rentetan, apapun yang string 'datatypes.
For literal insertion, put the strings between the single quote ' in the SQL statement. Untuk literal insersi, menempatkan string antara satu kutipan 'dalam pernyataan SQL.
Example and Usage : Contoh dan Penggunaan:
SELECT 'Name is ' || name FROM table; SELECT 'Nama' | | nama FROM tabel;
Name is whatever_name Nama whatever_name
SELECT number || ' – ' || description FROM table ORDER BY number SELECT nomor | | '-' | | keterangan FROM tabel ORDER BY nomor
1 – description 1 1 - deskripsi 1
2 – description 2 2 - deskripsi 2
Advance Usage : Advance Penggunaan:
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. Kemungkinan untuk menggunakan rangkaian dan Literal Tepat untuk menghasilkan satu set bahasa SQL query secara otomatis, terutama bila harus melakukan operasi sama ke banyak meja, yakni menurun banyak meja. 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. Untuk melakukan ini, formatah SQL bahasa permintaan data ke output hasil pencariannya dalam format SQL berlaku, dan yang spool Permintaan SQL hasil ke file. Then execute the file that contains SQL statements. Kemudian jalankan file yang berisi pernyataan SQL.
Example: Contoh:
SELECT 'DROP TYPE ' || type_name || ';' SELECT 'DROP JENIS' | | type_name | | ';'
will generates: akan menghasilkan:
DROP TYPE type_name DROP TYPE type_name
that can be run at SQL*Plus by calling the file with @filename. yang dapat dijalankan di SQL * Plus oleh memanggil file dengan nama file @. All types that been selected from first SQL statements will be dropped from the database. Semua jenis yang telah dipilih dari statemen SQL pertama akan turun dari database.
IMPORTANT : The page is machine translated and provided "as is" without warranty. PENTING: Halaman yang diterjemahkan mesin dan diberikan "sebagaimana adanya" tanpa jaminan. Machine translation may be difficult to understand. Mesin terjemahan mungkin sulit dimengerti. Please refer to Silakan merujuk ke original English article artikel asli Inggris whenever possible. bila memungkinkan.
Related Articles Artikel Terkait
- How to Escape Characters in Oracle PL/SQL Queries Bagaimana Escape Karakter dalam Oracle PL / SQL Query
- Oracle EXP-00091 Error When Export Database Oracle EXP-00091 Kesalahan Ketika Ekspor Database
- Insert and Fill Random Filler Text and Lorem Ipsum Into Office Word, Execel and PowerPoint 2007 Isi dan memasukkan teks dan Random filler Lorem Ipsum Ke Office Word, Execel dan PowerPoint 2007
- Change Oracle Database User Password Ubah Oracle Database User Password
- ORA-01502 Oracle Index in Unusable State Ora-01502 Oracle Indeks di unusable Negara
- Check Oracle Version Periksa Versi Oracle
- IMP-00016 Required Character Set Conversion Not Supported Error when Import to Oracle Database IMP-00016 disyaratkan Character Set Konversi Tidak Didukung Kesalahan ketika Impor ke Database Oracle
- Manual and Clean Uninstall Oracle for Windows Manual dan Bersih Uninstall Oracle untuk Windows
- Oracle ORA-01658 Unable to Create INITIAL Extent for Segment in Tablespace Error Oracle Ora-01658 Tidak dapat Buat Luas awal untuk Segmen dalam Tablespace Kesalahan
- Oracle Database Import Error 3113/3114 Oracle Database Impor Kesalahan 3113/3114










































March 2nd, 2007 21:57 2 Mar 2007 21:57
Good article. Good artikel. Got what I was looking for… Got what I was looking for ...