Hi sailendra/David,
I have worked based on your inputs to get the employed hours of an employee.It is working fine.
Please take a look in below query..Thanks alot..
/ Formatted on 2009/10/06 14:53 (Formatter Plus v4.8.6) /
SELECT ppf.full_name,
(SUM ( NVL (pps.actual_termination_date, TRUNC (SYSDATE))
– pps.date_start
)
)
/ 7 actual,
ROUND ( ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE))
– pps.date_start
)
)
/ 7
)
– FLOOR ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
),
2
) deci,
(FLOOR ( (SUM ( NVL (pps.actual_termination_date, TRUNC (SYSDATE))
– pps.date_start
)
)
/ 7
)
) integ,
( ROUND ( ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
)
– FLOOR ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
),
2
)
9
) a,
( (FLOOR ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
)
)
45
) b,
( ROUND ( ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
)
– FLOOR ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
),
2
)
9
)
+ ( (FLOOR ( (SUM ( NVL (pps.actual_termination_date,
TRUNC (SYSDATE)
)
– pps.date_start
)
)
/ 7
)
)
45
) c
FROM per_periods_of_service pps, per_all_people_f ppf
WHERE pps.person_id = ppf.person_id
AND pps.actual_termination_date BETWEEN ppf.effective_start_date
AND ppf.effective_end_date
AND ppf.full_name = ‘Ahad, Mr. Abdul’
GROUP BY ppf.full_name
—————————————————————————————————
but there is one more requirement on the same scenraio..
i need to capture the folliwing details in one user defined Table.
employee_name person_id start_date employed hours Day.
—————- ————— ————— ———————— ———
shailesh 111 01-mar-2009 9 SUNDAY
shailesh 111 02-mar-2009 9 Monday
shailesh 111 03-mar-2009 9 Tuesday
David 222 05-sep-2009 9 Friday
david 222 06-sep-2009 9 saturd
——-—————————————————————————————————
In the above table i need to capture the employed hours as 9 irrespective of day from his joining date to sysdate.
Here to caputre the start date ,do we need to take sequence?and employee hours is constant as 9.
Please give me rough idea.