Load changer functions in Oracle

Source: Internet
Author: User

A function that converts a date into characters:
To_char (Date[,fmt[,params])
Default format: DD-MON-RR
Parameter description:
Date: Dates that will be loaded
FMT: Format for swapping
Params: The language of the date (can not be written)
Example:
Sql> Select To_char (sysdate, ' Yyyy-mm-dd HH24:MI:SS ') from dual;

To_char (sysdate, ' YY
-------------------
2016-04-21 07:55:54


A function that converts a character type into a date:
To_date (Char[,fmt[,params])
Example:
Sql> Select To_date (' 2015-05-22 ', ' YYYY-MM-DD ') from dual;

To_date (' 2015-
--------------
2 February-May-15

3. Convert numbers into characters
To_char (Number[,fmt]):
Number indicates the format to convert, and the FMT represents the converted
Value of FMT:
[9] Indicates that the number is displayed and ignores the previous 0,
[0] indicates that the number is displayed, the number of bits is insufficient, with 0
[. or d] indicates that the decimal point is displayed,
[, or G] indicates the display of the thousand characters,
[$] Represents a dollar symbol,
[S] indicates the plus sign (both front and rear can)
Example:
Sql> Select To_char (12345.678, ' $99,999.999 ') from dual;

To_char (1234
------------
$12,345.678

Sql> Select To_char (12345.678, ' $99,999,999 ') from dual;

To_char (1234
------------
$12,346
(No decimal point will be rounded up and swapped)


The characters are replaced with numbers:
To_number (Char[,fmt])
Example:
Sql> Select To_number (' $1,000 ', ' $9999 ') from dual;

To_number (' $1,000 ', ' $9999 ')
---------------------------
1000

Load changer functions in Oracle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.