Oracle PL/SQL Tutorial/Conversion Functions/Introduction

Материал из SQL эксперт
Версия от 10:08, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Conversion Functions

Function Description ASCIISTR(x) Converts x to an ASCII string, where x may be a string in any character set. BIN_TO_NUM(x) Converts x to a binary number. Returns a NUMBER. CAST(x AS type_name) Converts a value in x from one data type to another specified in type_name. CHARTOROWID(x) Converts x to a ROWID. COMPOSE(x) Converts x to a Unicode string in its fully normalized form in the same character set as x. Unicode uses a 2-byte character set and can represent over 65,000 characters; it may also be used to represent non-English characters. CONVERT(x, source_char_set, dest_char_set) Converts x from source_char_set to dest_char_set. DECODE(x, search, result, default) Compares x with the value in search; if equal, DECODE() returns search, otherwise the value in default is returned. DECOMPOSE(x) Converts x to a Unicode string after decomposition in the same character set as x. HEXTORAW(x) Converts the character x containing hexadecimal digits (base 16) to a binary number (RAW). This function returns the returns RAW number. NUMTODSINTERVAL(x) Converts the number x to an INTERVAL DAY TO SECOND. You"ll learn about date and time intervalCrelated functions in the next chapter. NUMTOYMINTERVAL(x) Convert the number x to an INTERVAL YEAR TO MONTH. RAWTOHEX(x) Converts the binary number (RAW) x to a VARCHAR2 character containing the equivalent hexadecimal number. RAWTONHEX(x) Converts the binary number (RAW) x to an NVARCHAR2 character containing the equivalent hexadecimal number. An NVARCHAR2 is used to store strings in the national character set. ROWIDTOCHAR(x) Converts the ROWID x to a VARCHAR2 character. ROWIDTONCHAR(x) Converts the ROWID x to an NVARCHAR2 character. TO_BINARY_DOUBLE(x) New for Oracle Database 10g. Converts x to a BINARY_DOUBLE. TO_BINARY_FLOAT(x) New for Oracle Database 10g. Converts x to a BINARY_FLOAT. TO_CHAR(x [, format]) Converts x to a VARCHAR2 string. You can supply an optional format that indicates the format of x. TO_CLOB(x) Converts x to a character large object (CLOB). A CLOB is used to store large amounts of character data. TO_DATE(x [, format]) Converts x to a DATE. TO_DSINTERVAL(x) Convert the string x to an INTERVAL DAY TO SECOND. TO_MULTI_BYTE(x) Converts the single-byte characters in x to their corresponding multi-byte characters. The return type is the same as the type for x. TO_NCHAR(x) Converts x in the database character set to an NVARCHAR2. TO_NCLOB(x) Converts x to an NCLOB. An NCLOB is used to store large amounts of national language character data. TO_NUMBER(x [, format]) Converts x to a NUMBER. TO_SINGLE_BYTE(x) Converts the multi-byte characters in x to their corresponding single-byte characters. The return type is the same as the type for x. TO_TIMESTAMP(x) Converts the string x to a TIMESTAMP. TO_TIMESTAMP_TZ(x) Converts the string x to a TIMESTAMP WITH TIME ZONE. TO_YMINTERVAL(x) Converts the string x to an INTERVAL YEAR TO MONTH. TRANSLATE(x, from_string, to_string) Converts all occurrences of from_string in x to to_string. UNISTR(x) Converts the characters in x to the national language character set (NCHAR).

Quote from:

Oracle Database 10g SQL (Osborne ORACLE Press Series) (Paperback)

# Paperback: 608 pages

# Publisher: McGraw-Hill Osborne Media; 1st edition (February 20, 2004)

# Language: English

# ISBN-10: 0072229810

# ISBN-13: 978-0072229813