Timesampe_hex_to_char function solves time 16 visualization problems

Source: Internet
Author: User

The 11G provides a SQL view of more than 4 seconds that contains a lot of necessary information and can be used

--View more than 4 seconds statement execution plan
SELECT dbms_sqltune.report_sql_monitor (sql_id = ' &sql_id ', report_level = ' all ',type=> ' TEXT ') Comm from Dual

Get something in a format that's flattering

But one

Binds
=============================================================================================================== =========
| Name |   Position |                                         Type | Value |
=============================================================================================================== =========
|        : 1 | 1 | TIMESTAMP | 78720c0d010101 |
|        : 2 | 2 | TIMESTAMP | 78720c0d183c3c |
|        : 3 | 3 | number | 3 |
|        : 4 | 4 | number | 10000978 |
|        : 5 | 5 | TIMESTAMP | 78720c0d010101 |
|        : 6 | 6 | TIMESTAMP | 78720c0d183c3c |
|        : 7 | 7 | number | 10000978 |
|        : 8 | 8 | number | 2 |
|        : 9 | 7 2 number | 1000 |
|       : 10 | 10 | number | 0 |
=============================================================================================================== =========

TIMESTAMP is 16 binary.

How do you make it so cute?

If the simple 16 binary is converted into 10 binary we can use the Windows calculator to play, but this is the time Ah, Oracle time storage rules are not the same OH. Yes, it's also a digital storage method.

In addition, there are positive negative numbers, decimals, indices.

Of course we have a time. The type contains the year date time milliseconds. These four-part algorithms are not the same.

You can select DUMP (sysdate) from DUAL to get a comparison

The verbose function. This function solves the month day and time

Create or Replace function hex_to_date (hexstr in varchar2) return timestamp asbegin if Length (hexstr) <>  return null;  End If;                      Return To_timestamp (To_char (To_number (substr (HEXSTR, 1, 2), ' xx ')-+, ' fm00 ') | |                      To_char (To_number (substr (Hexstr, 3, 2), ' xx ')-+, ' fm00 ') | |                      To_char (To_number (substr (Hexstr, 5, 2), ' xx '), ' fm00 ') | |                      To_char (To_number (substr (HEXSTR, 7, 2), ' xx '), ' fm00 ') | |                      To_char (To_number (substr (HEXSTR, 9, 2), ' xx ')-1, ' fm00 ') | |                      To_char (To_number (substr (Hexstr, one, 2), ' xx ')-1, ' fm00 ') | | To_char (To_number (substr (HEXSTR, 2), ' xx ')-1, ' fm00 '), ' YYYYMMDDHH 24miss '); end;


Timesampe_hex_to_char function solves time 16 visualization problems

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.