年龄算法(Age algorithm).doc

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
年龄算法(Age algorithm)

年龄算法(Age algorithm) function fun _ get _ nl (for _ csrq dates, to _ dqrq dates, as _ xz in varchar2) return varchar2 is result varchar2 (50). no _ months number; no _ days number; no _ year number. d _ dqrq dates; s _ xz varchar2 (20). s _ nl varchar2 (50). begin if to _ csrq is null or to _ csrq = to _ dates (1900 - 1 - 1 , yyyy-mm-dd ) then result: = ; return (result); end if; if to _ dqrq is null or to _ dqrq = to _ dates (1900 - 1 - 1 , yyyy-mm-dd ) then d _ dqrq: = sysdate; else d _ dqrq: = _ dqrq; end if; if as _ xz is null then d = _ xz: banlsf; else s _ xz = as _ xz. end if; - 计算日数 select round (d _ dqrq - _ csrq) into n _ days from dual; if no _ days 1 then no _ days = 1; end if; - 计算年数 select to _ number (to _ char (d _ dqrq, yyyy) to _ number (to _ char (_ csrq, yyyy) into n _ year from dual; if no _ year 0 then no _ year: = 0; end if; - 联众病案系统年龄算法 if s _ xz = banlsf is then select to _ number (to _ char (d _ dqrq, yyyy) * 12 + to _ number (to _ char (d _ dqrq, mm)) (to _ number (to _ char (_ csrq, yyyy) * 12 + to _ number (to _ char (_ csrq, mm)) into n _ months from dual; if no _ months 12 then s _ nl = to _ char (trunc (n _ months / 12)) | |s 岁; elsif n _ months 1 then if no _ days 32 then s _ nl = to _ char (trunc (n _ days) | |s 天; else s _ nl = to _ char (trunc (n _ months) | |s 个月; end if; else s _ nl = to _ char (trunc (n _ days) | |s 天; end if; elsifs _ xz = xs is then if no _ days 100 then s _ nl = to _ char (trunc (n _ days) | |s 天; elsif n _ days - 735 then s _ nl = to _ char (trunc (n _ days / 30.5,0) | |s 个月; else s _ nl = to _ char (n _ year + 1) | |s 岁; end if; elsifs _ xz = xs1 is then if no _ days 100 then s _ nl = to _ char (trunc (n _ days) | |s 天; elsif n _ days - 735 then s _ nl = to _ char (trunc (n _ days / 30.5,0) | |s 个月; else if to _ char (_ csrq, mmdd) = to _ char (d _ dqrq, mmdd) then s _ nl = to _ char (n _ year + 2) | |s 岁; else s _ nl = to _ char (n _ year + 1) | |s 岁; end if; end if; elsifs _ xz = zs is then if n

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档