try select max(nvl(HSTime,sysdate)) INTO LastDay FROM SA.Sys_DepotDayHead; or select max(nvl(HSTime,otherdatetypevalue)) INTO LastDay FROM SA.Sys_DepotDayHead;because 0 is not a date type;
试试这个 select max(nvl(HSTime,'1900-01-01') INTO LastDay FROM SA.Sys_DepotDayHead; 要是不行,下面的肯定行 select max(nvl(HSTime,to_date('1900-01-01','yyyy-mm-dd')) INTO LastDay FROM SA.Sys_DepotDayHead;
select max(HSTime) INTO LastDay FROM SA.Sys_DepotDayHead exception when not_data_found then LastDay:=...; end;
select max(nvl(HSTime,sysdate)) from SA.Sys_DepotDayHead
select max(nvl(HSTime,0)) INTO LastDay FROM SA.Sys_DepotDayHead; 楼主为什么要这么写呀? select max(HSTime) INTO LastDay FROM SA.Sys_DepotDayHead; 这样就好了呀?! 然后判断 LastDay is null ? 就好了呀!
select max(nvl(HSTime,sysdate)) INTO LastDay FROM SA.Sys_DepotDayHead;
or
select max(nvl(HSTime,otherdatetypevalue)) INTO LastDay FROM SA.Sys_DepotDayHead;because 0 is not a date type;
select max(nvl(HSTime,'1900-01-01') INTO LastDay FROM SA.Sys_DepotDayHead;
要是不行,下面的肯定行
select max(nvl(HSTime,to_date('1900-01-01','yyyy-mm-dd')) INTO LastDay FROM SA.Sys_DepotDayHead;
exception
when not_data_found then
LastDay:=...;
end;
楼主为什么要这么写呀?
select max(HSTime) INTO LastDay FROM SA.Sys_DepotDayHead;
这样就好了呀?!
然后判断 LastDay is null ? 就好了呀!