Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get the no-parameter function of timestamp in oracle database

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to get the no-parameter function of timestamp in oracle database. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

The code is as follows:

CREATE OR REPLACE FUNCTION GETMSTIMESTAMP RETURN NUMBER AS MSTIMESTAMP NUMBER; BEGIN SELECT (SYSDATE-TO_DATE ('1970-1-18,' YYYY-MM-DD HH24')) * 86400000 + TO_NUMBER (TO_CHAR (SYSTIMESTAMP (3), 'FF')) INTO MSTIMESTAMP FROM DUAL; RETURN MSTIMESTAMP; END

After that, you can use select GETMSTIMESTAMP () as timestamp from dual; in mapper files or pl/sql and other tools.

Get a second timestamp:

SELECT (SYSDATE-TO_DATE ('1970-1-1-18)) * 86400 FROM DUAL; (SYSDATE-TO_DATE (' 1970-1-18)) * 86400 Mustang 1167040878

Subtract the current time from 8: 00 on January 1, 1970, and multiply the number of days by 24 hours by 3600 seconds, and the result is the system timestamp. The reason used here is 8: 00, when the time zone of the system is East 8.

Millisecond timestamp:

SELECT (SYSDATE-TO_DATE ('1970-1-18,' YYYY-MM-DD HH24')) * 86400000 + TO_NUMBER (TO_CHAR (SYSTIMESTAMP (3), 'FF')) AS MILLIONS FROM DUAL; after reading the above, do you have any further understanding of how to obtain the timestamped no-parameter function in the oracle database? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report