Advertisement
Advertisement
| 02.22.2008 at 07:27AM PST, ID: 23184703 | Points: 250 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: |
CREATE OR REPLACE PACKAGE BODY xxmlRefCursor IS PROCEDURE get_calendar(p_date DATE, the_cursor IN OUT ref_cursor) IS l_query long := 'select name, manager, department '; p_start date; p_end date; BEGIN select last_day(p_date) into p_end from dual; select to_date(substr(p_date,4,3),'MON') into p_start from dual; for i in 1 .. trunc(p_end)-trunc(p_start)+1 LOOP l_query := l_query || ', max( decode( trunc(date_start), ' || 'to_date( ''' || to_char(p_start+i-1,'yyyymmdd') || ''', ''yyyymmdd'' ), absence_category, 0 )) "' || to_char(p_start+i-1) || '"'; END LOOP; l_query := l_query || ' from xxml_absence_person group by name, manager, department'; OPEN the_cursor FOR l_query; END get_calendar; END xxmlRefCursor; |