Insert Text Literal and Concatenation in Oracle SQL Įterpti tekstą literatūros ir sąryšis Oracle SQL
In Oracle, it's possible to insert literal or concatenate 2 or more charater strings or SQL result output together. Oracle, tai įmanoma įterpti pažodžiui arba Jungiant 2 ar daugiau charater eilučių arba SQL rezultato kartu. This manipulation allows you to manipulate the format of data returned by SQL query. Šis manipuliavimas leidžia manipuliuoti duomenimis grąžino SQL užklausos formą.
Two solid vertical bar || operator is used to concatenate 2 or more strings. Du kietųjų vertikalios juostos | | operatoriaus naudojamas Jungiant 2 ar daugiau eilučių. 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. Be Oracle, taip pat numatyta Concat pobūdžio funkcijas alternatyva vertikali juosta operatorius tiesiog jeigu yra situacija, kai sunku ar neįmanoma kontroliuoti vertimo atliekamas operacinės sistemos arba tinklo komunalinės paslaugos. This function should be used in applications that will be moved between environments with differing character sets. Ši funkcija turi būti naudojami pagal paskirtį, kad bus perkeltas tarp aplinkose su skirtingais simbolių rinkiniai.
Oracle will automatically casts values into types which can be concatenated. Oracle automatiškai verčia vertybes į tipus, kurie gali būti sudurtiniai. 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 aiškina NULL, kaip tuščia (nulinio ilgio) raidžių, tai nereiškia grįžimo NULL, jei operandas yra NULL, tai reiškia, concatenating nulinio ilgio simbolių seka kito operando visada sukelia kitų operando, kad niekiniai gali atsirasti tik iš dviejų null stygos sąryšis. To concatenate an expression that might be null, use the NVL function to explicitly convert the expression to a zero-length string. Jungiant išraiška, kuri gali būti nulis, naudokite NVL funkcija aiškiai paversti išraiška nulinio ilgio eilutės.
Concatenating two strings results in another character string. Concatenating dvi eilutes rezultatus kitoje raidžių. If both character strings are of datatype CHAR, the result has datatype CHAR and is limited to 2000 characters. Jeigu tiek simbolių eilutės yra datatype CHAR, rezultatas datatype CHAR ir trukmė yra apribojama iki 2000 simbolių. If either string is of datatype VARCHAR2, the result has datatype VARCHAR2 and is limited to 4000 characters. Jei kuri nors eilutė yra datatype VARCHAR2, rezultatas datatype VARCHAR2 ir yra ribota iki 4000 simbolių. Trailing blanks in character strings are preserved by concatenation, regardless of the strings' datatypes. Galiniais tarpais iš simbolių eilučių konservuoti sąryšis, nepriklausomai nuo eilutės "duomenų tipai.
For literal insertion, put the strings between the single quote ' in the SQL statement. Dėl pažodinis įterpimas, įdėkite tarp eilučių viengubas kabutes 'in SQL.
Example and Usage : Pavyzdys ir naudojimas:
SELECT 'Name is ' || name FROM table; Pasirinkite "Vardas" | | pavadinimas lentelėje;
Name is whatever_name Vardas whatever_name
SELECT number || ' – ' || description FROM table ORDER BY number PASIRINKITE skaičius | | '-' | | Description Lentelė ORDER BY numeris
1 – description 1 1 - 1 aprašymas
2 – description 2 2 - 2 aprašymas
Advance Usage : Išankstinis Naudojimas:
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. Ji galima naudoti ir sujungimas Literal Insertion sukurti SQL užklausų kalba automatiškai nustatyti, ypač kai reikia atlikti tos pačios operacijos būtų daug lentelių, ty nuleisti lentelių aikštelė. 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. Norėdami tai padaryti, formatas SQL užklausų kalba išvesties užklausos rezultatas galioja SQL formatas, ir Eigos SQL užklausos rezultatus į failą. Then execute the file that contains SQL statements. Tada paleisti failą, kuriame yra SQL.
Example: Pavyzdys
SELECT 'DROP TYPE ' || type_name || ';' Pasirinkite "DROP RŪŠIS" | | type_name | | "";
will generates: bus generuoja:
DROP TYPE type_name DROP TIPAS type_name
that can be run at SQL*Plus by calling the file with @filename. kad būtų galima važiuoti SQL * Plus telefonu failą @ filename. All types that been selected from first SQL statements will be dropped from the database. Visos rūšys, kad buvo pasirinktas iš pirmojo SQL bus ištrintas iš duomenų bazės.
IMPORTANT : The page is machine translated and provided "as is" without warranty. DĖMESIO: Šis puslapis yra mašina išvertė ir pateikiama "kaip yra" be garantijų. Machine translation may be difficult to understand. Automatinis vertimas gali būti sunku suprasti. Please refer to Remkitės original English article originalas anglų straipsnis whenever possible. jei įmanoma.
Related Articles Susiję straipsniai
- How to Escape Characters in Oracle PL/SQL Queries Kaip išvengti Veikėjai Oracle PL / SQL Queries
- Use {Literal} Smarty Tag to Add Google Analytics Tracking Code to BlogSome Hosted Blogs Naudokite (literal) Smarty Tag Pridėti prie "Google Analytics" stebėjimo kodą į BlogSome Patalpinta Dienoraščiai
- Oracle EXP-00091 Error When Export Database Oracle Tinka-00091 Klaida Eksporto duomenų bazė
- Insert and Fill Random Filler Text and Lorem Ipsum Into Office Word, Execel and PowerPoint 2007 Įterpti ir užpildyti Atsitiktinė Filler Tekstas ir Lorem Ipsum Into Office Word Execel ir PowerPoint 2007
- Change Oracle Database User Password Keisti Oracle Vartotojas Slaptažodis
- Check Oracle Version Patikrinkite Oracle versija
- ORA-01502 Oracle Index in Unusable State ORA-01502 Oracle indeksas Nenaudojamos narė
- IMP-00016 Required Character Set Conversion Not Supported Error when Import to Oracle Database IMP-00016 Privalomas Character Set konversijos Not Supported klaidą Importas į duomenų bazę Oracle
- Manual and Clean Uninstall Oracle for Windows Rankinis ir švarios Pašalinti Oracle Windows
- Oracle ORA-01658 Unable to Create INITIAL Extent for Segment in Tablespace Error "Oracle" ORA-01658 Nepavyko sukurti PRADINĖ laipsniu segmente Tablespace Klaida










































March 2nd, 2007 21:57 2 kovas 2007 21:57
Good article. Geras straipsnis. Got what I was looking for… Turite ką aš ieškojau ...