OracleDBTO_CHAR, TO_DATE, and TO_NUMBER Functions

Source: Internet
Author: User
OracleDBTO_CHAR, TO_DATE, and TO_NUMBER functions. TO_CHAR can convert the datetime data type to the Data Type in the format specified by format_model.

Oracle DB TO_CHAR, TO_DATE, and TO_NUMBER functions. TO_CHAR can convert the datetime data type to the Data Type in the format specified by format_model.

The SQL statement in the example shows the last name and employment date of all employees. The employment date is displayed as "17 June 1987 ".

Example:

Modify the example in the slide so that it displays the date in the format of "Seventeenth of June 1987 12:00:00 AM.

Hr @ TEST0924> SELECT last_name, TO_CHAR (hire_date, 'fmddspth "of" Month YYYY fmHH: MI: SS am') hiredate from employees;

LAST_NAME HIREDATE

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

OConnell Twenty-First of June 2007 12:00:00 AM

Grant Thirteenth of January 2008 12:00:00 AM

Whalen Seventeenth of September 2003 12:00:00 AM

Hartstein Seventeenth of February 2004 12:00:00 AM

...

107 rows selected.

Note that the month follows the specified format. In other words, the first letter and other letters are in lowercase.

For more details, please continue to read the highlights on the next page:

Related reading:

Functions, packages, and triggers in Oracle databases

Learning window functions over () in Oracle

Oracle Database random number generation function

Oracle custom functions query data dictionary items

Oracle date functions/character functions/numeric functions/conversion functions/Aggregate functions

Decode () function instructions 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.