1
2
|
-- Add/modify columns
alter
table
EMP
add
BONUS number;
|
No | Item | Label | Source (Type= Database Column) |
1 | P300_EMPNO | Empno | EMPNO |
2 | P300_ENAME | Ename | ENAME |
3 | P300_JOB | Job | JOB |
4 | P300_MGR | Manager | MGR |
5 | P300_HIREDATE | Hiredate | HIREDATE |
6 | P300_SAL | Salary | SAL |
7 | P300_COMM | Commission | COMM |
8 | P300_BONUS | Bonus | BONUS |
9 | P300_DEPTNO | Deptno | DEPTNO |
The value of P300_EMPNO is pass from outside, "Fetch EMP Row" Process will query EMP table with EMPNO = :P300_EMPNO at a time before the page is renderred, and assign values to the other items.
Note: P300_LOCATION and P300_NUM_EMPLOYEES are items not based on columns of a table, its value is calculated at the time of "Page Load" so you need to put "Save Session State = NO".
1
2
3
4
5
6
7
|
Select
d.Loc Location
,
Count
(e.Empno) Num_Employees
From
Dept d
,Emp e
Where
d.Deptno = e.Deptno(+)
And
d.Deptno = :P300_Deptno
Group
By
d.Loc
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
Declare
v_Multiplier Number;
Begin
-- Determine multiplier based on job.
Case
:P300_Job
When
'CLERK'
Then
v_Multiplier := 0.1;
When
'ANALYST'
Then
v_Multiplier := 0.2;
When
'SALESMAN'
Then
v_Multiplier := 0.3;
When
'MANAGER'
Then
v_Multiplier := 0.4;
When
'PRESIDENT'
Then
v_Multiplier := 0.5;
Else
v_Multiplier := 0;
End
Case
;
-- Return bonus which is calculated by
-- Multiplying Salary My Multiplier
Return
:P300_Sal * v_Multiplier;
End
;
|