CREATE OR REPLACE PACKAGE BODY ois_pkg IS FUNCTION fn_tss_get_vsl_band(start_dt_in IN berth_allocation.atb_dt%TYPE, end_dt_in IN berth_allocation.atb_dt%TYPE) RETURN ref_cursor AS band_cursor ref_cursor; BEGIN OPEN band_cursor FOR SELECT v.vv_c, v.berth_seq_n, v.abbr_vessel_m, v.abbr_voyage_out_n, h.berth_m, v.atb_dt,v.atu_dt,b.band_m FROM v_berth_allocation v, vessel_target t, band b, berth h WHERE v.vv_c = t.vv_c AND v.berth_seq_n = t.berth_seq_n AND t.band_c = b.band_c AND v.terminal_c = h.terminal_c AND v.berth_n = h.berth_n AND h.berth_m NOT LIKE 'M%' AND (v.atb_dt>=sysdate-5 and v.atb_dt<= end_dt_in) AND (v.atu_dt is null OR (v.atu_dt>=start_dt_in and v.atu_dt<=sysdate)); RETURN band_cursor; END; END ois_pkg; / sho errors; /