How to perform calculation on a particular record in datablock [message #663164] |
Wed, 24 May 2017 08:13 |
|
malya
Messages: 22 Registered: August 2015 Location: Hyderabad, India
|
Junior Member |
|
|
Hi Seniors,
How to perform calculation on a particular record in data block. below is example :
empid weekstartdate startdate enddate othours
0001 22-MAY-2017 23-MAY-2017 23-MAY-2017 4
0001 22-MAY-2017 24-MAY-2017 24-MAY-2017 4
0002 22-MAY-2017 23-MAY-2017 23-MAY-2017 6
0001 22-MAY-2017 25-MAY-2017 25-MAY-2017 4
So the block has 3 records of empid 0001 and total hours should come as 12 hours and for 0002, it is 6 hours.
I want to calculate it while entering the record or before saving so that I can restrict entering hours after particular limit.
Condition is - Employee cant have OT hours more than 15 hours.
thank in advance. Please help.
|
|
|
Re: How to perform calculation on a particular record in datablock [message #663173 is a reply to message #663164] |
Wed, 24 May 2017 11:54 |
|
Michel Cadot
Messages: 68729 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Here's an example:
SQL> select deptno, ename, sal,
2 count(*) over (partition by deptno) nb_in_dept,
3 sum(sal) over (partition by deptno) sum_sal_in_dept
4 from emp
5 order by 1, 2
6 /
DEPTNO ENAME SAL NB_IN_DEPT SUM_SAL_IN_DEPT
---------- ---------- ---------- ---------- ---------------
10 CLARK 2450 3 8750
10 KING 5000 3 8750
10 MILLER 1300 3 8750
20 ADAMS 1100 5 10875
20 FORD 3000 5 10875
20 JONES 2975 5 10875
20 SCOTT 3000 5 10875
20 SMITH 800 5 10875
30 ALLEN 1600 6 9400
30 BLAKE 2850 6 9400
30 JAMES 950 6 9400
30 MARTIN 1250 6 9400
30 TURNER 1500 6 9400
30 WARD 1250 6 9400
|
|
|