Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How does Oracle get the year and month

Shulou Source: shulou.com Published: 2022-06-02 05:25:16 09月23日 Update

This article mainly explains "how to get the year and month by Oracle". The explanation in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to get the year and month by Oracle".

CREATE OR REPLACE FUNCTION comm.get_year (start_date DATE,end_date DATE)

RETURN NUMBER

IS

Service_interval INTERVAL YEAR TO MONTH

Years_of_service NUMBER

BEGIN

Service_interval: = (end_date-start_date) YEAR TO MONTH

Years_of_service: = EXTRACT (YEAR FROM service_interval)

RETURN years_of_service

END

CREATE OR REPLACE FUNCTION comm.get_month (start_date DATE,end_date DATE)

RETURN NUMBER

IS

Service_interval INTERVAL YEAR TO MONTH

Months_of_service NUMBER

BEGIN

Service_interval: = (end_date-start_date) YEAR TO MONTH

Months_of_service: = EXTRACT (MONTH FROM service_interval)

RETURN months_of_service

END

Thank you for your reading, the above is the content of "how to get the year and month of Oracle". After the study of this article, I believe you have a deeper understanding of how to obtain the year and month of Oracle, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Learning content that is ideas situations articles more knowledge knowledge points articles follow questions practice push research verification Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information vpn MySQL OPPO Reno