-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcase_when02.sql
More file actions
32 lines (31 loc) · 837 Bytes
/
case_when02.sql
File metadata and controls
32 lines (31 loc) · 837 Bytes
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
28
29
30
31
select
STaLENESS, OSIZE, OBJ#, TYPE#,
case
when STaLENESS > .5 then 128
when STaLENESS > .1 then 256
else 0
end + aFLaGS aFLaGS,
STaTUS,
SID,
SERIaL#,
PaRT#,
BO#
,
case
when is_FULL_EVENTS_HisTorY = 1 then SRC.Bor_LasT_STaTUS_TIME
else
case GREaTEST (NVL (WP.Bor_LasT_STaT_TIME, date '1900-01-01'), NVL (SRC.Bor_LasT_STaTUS_TIME, date '1900-01-01'))
when date '1900-01-01' then null
when WP.Bor_LasT_STaT_TIME then WP.Bor_LasT_STaT_TIME
when SRC.Bor_LasT_STaTUS_TIME then SRC.Bor_LasT_STaTUS_TIME
else null
end
end
,
case GREaTEST (NVL (WP.Bor_LasT_STaT_TIME, date '1900-01-01'), NVL (SRC.Bor_LasT_STaTUS_TIME, date '1900-01-01'))
when date '1900-01-01' then null
when WP.Bor_LasT_STaT_TIME then WP.Bor_LasT_STaT_TIME
when SRC.Bor_LasT_STaTUS_TIME then SRC.Bor_LasT_STaTUS_TIME
else null
end
from X