Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-05-31 23:35:35 10月06日 Update

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.

Tags: Time content function data database system usage code reason days hours that is tools files time zone more knowledge articles results industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information OPPO Reno NVidia macOS