Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Semestr2 / 1 - Oracle / Oracle selected docs / SQL reference.pdf
Скачиваний:
24
Добавлен:
12.05.2015
Размер:
11.92 Mб
Скачать

TO_NCHAR (datetime)

Nur 39 EURO!

Die Tastatur KB 101/CH-DE ist eine Standard PC/AT Tastatur mit 102 Tasten. Tasta

turbelegung: Schweizerdeutsch.

. NEU: Kommt mit ergonomischer Schaumstoffunterlage.

. Extraflache und ergonimisch-geknickte Versionen verfugbar auf Anfrage.

. Lieferbar in Elfenbein, Rot oder Schwarz.

TO_NCHAR (datetime)

Syntax to_nchar_date::=

 

 

 

,

nlsparam

 

datetime

,

fmt

 

 

 

TO_NCHAR

(

 

 

 

 

)

 

interval

 

 

 

 

 

Purpose

TO_NCHAR (datetime) converts a character string of DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, INTERVAL MONTH TO YEAR, or INTERVAL DAY TO SECOND datatype from the database character set to the national character set.

Examples

SELECT TO_NCHAR(order_date) FROM orders

WHERE order_status > 9;

TO_NCHAR(ORDER_DATE)

----------------------------

14-SEP-99 08.53.40.223345 AM

13-SEP-99 09.19.00.654279 AM

27-JUN-00 08.53.32.335522 PM

26-JUN-00 09.19.43.190089 PM

06-DEC-99 01.22.34.225609 PM

Functions 6-181

TO_NCHAR (number)

TO_NCHAR (number)

Syntax to_nchar_number::=

 

 

 

,

nlsparam

 

 

,

fmt

 

 

 

TO_NCHAR

(

n

 

 

 

)

Purpose

TO_NCHAR (number) converts a number to a string in the NVARCHAR2 character set. The optional fmt and ’nlsparam’ corresponding to n can be of DATE,

TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, INTERVAL MONTH TO YEAR, or INTERVAL DAY TO SECOND datatype.

Examples

SELECT TO_NCHAR(customer_id) "NCHAR_Customer_ID" FROM orders

WHERE order_status > 9;

NCHAR_Customer_ID

-----------------

102

103

148

149

148

TO_NCLOB

Syntax to_nclob::=

 

 

lob_column

TO_NCLOB

(

)

 

 

char

Purpose

TO_NCLOB converts CLOB values in a LOB column or other character strings to NCLOB values. char can be any of the datatypes CHAR, VARCHAR2, NCHAR,

6-182 Oracle9i SQL Reference

TO_NUMBER

NVARCHAR2, CLOB, or NCLOB. Oracle implements this function by converting the character set of the LOB column from the database character set to the national character set.

Examples

The following example inserts some character data into an NCLOB column of the pm.print_media table by first converting the data with the TO_NCLOB function:

INSERT INTO print_media (product_id, ad_id, ad_fltextn)

VALUES (3502, 31001,

TO_NCLOB(’Placeholder for new product description’));

TO_NUMBER

Syntax to_number::=

 

 

 

,

nlsparam

 

 

,

fmt

 

 

 

TO_NUMBER

(

char

 

 

 

)

Purpose

TO_NUMBER converts char, a value of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype containing a number in the format specified by the optional format model fmt, to a value of NUMBER datatype.

Note: This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion. Please refer to "Datatype Comparison Rules" on page 2-45 for more information.

Examples

The following example converts character string data into a number:

UPDATE employees SET salary = salary +

TO_NUMBER(’100.00’, ’9G999D99’)

WHERE last_name = ’Perkins’;

Functions 6-183

TO_SINGLE_BYTE

The ’nlsparam’ string in this function has the same purpose as it does in the TO_ CHAR function for number conversions.

See Also: TO_CHAR (number) on page 6-173

SELECT TO_NUMBER(’-AusDollars100’,’L9G999D99’, ’ NLS_NUMERIC_CHARACTERS = ’’,.’’

NLS_CURRENCY = ’’AusDollars’’ ’) "Amount"

FROM DUAL;

Amount

----------

-100

TO_SINGLE_BYTE

Syntax to_single_byte::=

TO_SINGLE_BYTE ( char )

Purpose

TO_SINGLE_BYTE returns char with all of its multibyte characters converted to their corresponding single-byte characters. char can be of datatype CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The value returned is in the same datatype as char.

Any multibyte characters in char that have no single-byte equivalents appear in the output as multibyte characters. This function is useful only if your database character set contains both single-byte and multibyte characters.

Note: This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion. Please refer to "Datatype Comparison Rules" on page 2-45 for more information.

6-184 Oracle9i SQL Reference

Соседние файлы в папке Oracle selected docs