Practical application solution for Oracle data type conversion

Source: Internet
Author: User

This article mainly introduces the actual operations related to Oracle data type conversion to_char (date). If you are interested in the actual application solution of Oracle data type conversion, you can click the following article to learn more about it.

Oracle data type conversion includes explicit data type conversion and implicit data type conversion.

In general, implicit data type conversion is available, but we recommend that you convert the display data type to ensure the reliability of SQL. explicit data type conversion includes:

To_number character to number

To_date character to date

To_char numeric conversion to character

To_char date to TO_CHAR (date, 'format _ model ')

Must be enclosed in single quotes and case sensitive

Oracle data type conversion can contain any valid date format Element

There is a fm element used to delete the filled null, or the leading zero

Use a comma to separate the select employee_id, to_char (hire_date, 'Mm/yy') as month

 
 
  1. From employees
  2. Where last_name = 'higgin'
  3. Employee_id month
  4. 205 06/94
  5. Select to_char (sysdate, 'yyyy-mm-dd hh24: mi: ss am') as today from dual
  6. January 13:39:06 select to_char (to_date ('21--95 '), 'yyyy-mm-dd hh24: mi: ss am') as today from dual
  7. 00:00:00 select to_char (sysdate, 'dd "of" month ') from dual
  8. 24 of June select to_char (syadate, 'yyyy-mm-dd CC') from dual
  9. 2006-06-24 21
  10. Cc: century select to_char (sysdate, 'yyy-mm-dd CC') as today from dual
  11. 006-06-24 21
  12. Select to_char (sysdate, 'yy-mm-dd CC') as today from dual
  13. 06-06-24 21
  14. Select to_char (sysdate, 'y, yyy-mm-dd CC') as today from dual
  15. 2,006-06-24 21

The above content is an introduction to Oracle data type conversion. I hope you will find some gains.

Related Article

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.