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

Big data develops the sample code of Chinese age function

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces big data to develop the Chinese age function sample code, the article introduces in great detail, has a certain reference value, interested friends must read it!

Create or replace function CHINESEAGE (BirthDate in date, NowDate in date) return string is Result string (80);-- return value MonthCount number (4);-- month of birth DayCount number (6);-- remainder of the month (days) begin-- error if BirthDate > NowDate or BirthDate is null or NowDate is null Then Result: = 'unknown' if the birthday is greater than the current date Return (Result); end if;-get SELECT trunc (Mon), trunc ((Mon-trunc (Mon)) * 31) INTO MonthCount,DayCount FROM (SELECT months_between (NowDate, BirthDate) Mon FROM dual) V -- if you are more than 60 months old, your age will be # # years old if MonthCount > = 60 then Result: = to_char (trunc (MonthCount/12)) | | 'year';-- if you are 12-59 months old, your age will be # # years # / month elsif MonthCount > = 12 then Result: = to_char (trunc (MonthCount/12)) | | 'year' | | to_char (mod (MonthCount,12)) | | 'month' -if you are 1-11 months old, the age is displayed as # eptember # day elsif MonthCount > = 1 then Result: = to_char (MonthCount) | | 'month'; if DayCount > = 1 then Result: = Result | | to_char (DayCount) | | 'day'; end if -- if born 1 day-1 month, the age is displayed as # days elsif DayCount > = 1 then Result: = to_char (DayCount) | | 'day';-- if born less than 1 day, the age is displayed as 1 day else Result: ='1 day'; end if; return (Result); end The above is all the content of this article "big data develops the sample code of Chinese age function". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Internet Technology

Wechat

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

12
Report