Learn about Oracle data conversion functions

Source: Internet
Author: User

Oracle Data conversion functions are common functions. The following describes the usage of the two Oracle data conversion functions for your reference.

1) TO_CHAR

This function converts the date, time, and value into text. Its main value is to provide display control over the date, time, and number. This function is very flexible and complex to use. Here we only provide examples of commonly used conversions.

1) format the date and time values

TO_CHAR date data, format encoding)

Select to_char (sysdate, 'YYYY-MM-DD HH24: MI: ss ')

From dual;

Select to_char (sysdate, 'hh24: MI: ss ')

From dual;

Select to_char (sysdate, 'yyyy') | 'Year' |

To_char (sysdate, 'mm') | 'month' |

To_char (sysdate, 'dd') | 'day' date

From dual
2) format the value

Select to_char (5764.12345, '123') from dual;

Select to_char (5764.12345, '123') from dual;


2) TO_DATE

Converts the text to the actual Oracle date/time value. Format:

TO_DATE (text, Date Format)

Select to_date ('1970-10-10 11', 'yyyy-MM-DD hh24 ')

From dual;

Insert into item_test values (

'Name-x ',

To_date ('1970-10-25 ', 'yyyy-MM-DD '));

The preceding section describes the usage of Oracle Data conversion functions.

Introduction to Oracle System Variable Functions

Syntax for creating an Oracle package

Use of Oracle to_char Functions

Implementation of oracle function return table

Learn about the Oracle FBI Index

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.