欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle最大日期获取方法

程序员文章站 2023-11-05 16:30:22
在开发应用中如何获取oracle的最大日期呢?本文将提供这样一个获取方法,需要的朋友可以参考下sql代码 复制代码 代码如下: -- created on 2010/06/...
在开发应用中如何获取oracle的最大日期呢?本文将提供这样一个获取方法,需要的朋友可以参考下
sql代码
复制代码 代码如下:

-- created on 2010/06/08 by nan
declare
-- local variables here
type t_test is table of date index by binary_integer;
v_test t_test;
v_date date;
begin
-- test statements here
v_test(1) := '20020202';
v_test(2) := '20090202';
v_test(3) := '20100202';
for i in 1 ..v_test.count loop
if v_date is null then
v_date := v_test( 1);
end if ;
if v_date < v_test(i) then
v_date := v_test(i);
end if ;
end loop;
dbms_output.put_line(v_date);
exception
when others then
dbms_output.put_line( sqlerrm);
end;