PLSQL存储过程输出问题
我单身呢 2017-11-08 10:37:17 create or replace procedure p_test3(v_begin_date date,v_end_date date)
is
cursor c_test1 is select * from test1 where (v_begin_date<=end_date)
and (v_end_date>=begin_date);
begin
for v_test1 in c_test1 loop
if v_begin_date<=v_end_date then
dbms_output.put_line(v_test1.id||'---'||v_test1.begin_date||'------'||v_test1.end_date);
else
dbms_output.put_line('开始日期不能大于结束日期');
end if;
end loop;
end;
--
begin
p_test3(to_date('2017-01-21','yyyy-mm-dd'),to_date('2017-01-20','yyyy-mm-dd'));
end;
得到的是两条数据:
开始日期不能大于结束日期;
开始日期不能大于结束日期;
为什么会得到两条这种数据,不应该是一条么?该怎么修改?