declare
in_put_mon varchar2(100) := '01-FEB-2000';
in_put_row number := 32;
lv_last_date varchar2(10);
lv_get_day varchar2(10);
lv_get_date date;
type ref_c1 is ref cursor;
c1 ref_c1;
type obj_val_output is table of varchar2(10) index by binary_integer;
lv_val_output obj_val_output;
begin
select last_day(in_put_mon) into lv_last_date from dual;
dbms_output.put_line('lv_last_date' || lv_last_date);
open c1 for 'SELECT trunc(to_date(' || chr(39) || in_put_mon || chr(39) || ',''dd-mon-yyyy''),''mon'') + ROWNUM - 1 val FROM all_objects WHERE rownum < ' || in_put_row;
fetch c1 bulk collect into lv_val_output;
for i in 1..lv_val_output.count loop
dbms_output.put_line('Date: >>> ' || lv_val_output(i));
lv_get_date := lv_val_output(i);
lv_get_day := to_char(lv_get_date,'Day');
dbms_output.put_line('Day : >>> ' || lv_get_day );
if lv_last_date = lv_val_output(i) then
return;
end if;
end loop;
end;
Bookmarks