Code
1 select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and ((start_date <= sysdate
6 and end_date >= sysdate)
7 or (start_date <= sysdate and end_date is null));
1 select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and ((start_date <= sysdate
6 and end_date >= sysdate)
7 or (start_date <= sysdate and end_date is null));
修改后:
Code
1 select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and start_date <= sysdate
6 and nvl(end_date, sysdate + 1) >= sysdate;
1 select count(1)
2 into l_line_num --l_number_of_day
3 from hek_om_pop_validity_all
4 where inventory_item_id = l_item_id
5 and start_date <= sysdate
6 and nvl(end_date, sysdate + 1) >= sysdate;