17,380
社区成员
发帖
与我相关
我的任务
分享
select * from classinfo c1 where not exists (select 1 from classinfo where curr_date>c.curr_date);create or replace procedure test_proc(p_cur out sys_refcursor)
as
l_count number:=0;
begin
select count(*) into l_count from classinfo where curr_date >=to_date(sysdate,'yyyy-mm-dd') and curr_date <=to_date(sysdate+1,'yyyy-mm-dd');
if l_count =0 then
open p_cur for select * from classinfo where curr_date =(select max(curr_date) from classinfo);
else
open p_cur for select * from classinfo where curr_date >=to_date(sysdate,'yyyy-mm-dd') and curr_date <=to_date(sysdate+1,'yyyy-mm-dd');
end;
end;