Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT first_date, last_date, work_code,TO_CHAR(first_date,'Day'),TO_CHAR(last_date,'Day'),'Sick',SUM(hrs) FROM (SELECT ptd.*
- FROM pd_trf_day ptd, work_code wc, person p, vo_person_category vopc
- WHERE ptd.work_code_id = wc.work_code_id
- AND wc.work_code_std_category_id = 2
- AND ptd.person_id = p.person_id
- AND p.vo_person_category_id = vopc.vo_person_category_id
- AND (317219 IS NULL OR ptd.person_id = 317219)
- AND (101420 IS NULL OR vopc.vehicle_owner_id = 101420)
- AND (111928 IS NULL OR vopc.vo_person_category_id = 111928)
- AND (SYSDATE - 365 IS NULL OR ptd.date_day >= SYSDATE - 365)
- AND (SYSDATE IS NULL OR ptd.date_day <= SYSDATE)
- )
- match_recognize (
- ORDER BY date_day
- measures
- FIRST(date_day) AS first_date,
- LAST(date_day) AS last_date,
- NVL(trf_dhr,0) AS hrs,
- COUNT(*) AS days,
- work_code_id AS work_code,
- match_number() AS grp
- pattern ( strt consecutive* )
- define
- consecutive AS date_day = ( prev ( date_day ) + 1 )
- )
- GROUP BY first_date,last_date,work_code;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement