# | SNAP_ID | BEGIN_TIME | END_TIME | LINE1 | LINE2 |
---|---|---|---|---|---|
1 | 1 | 2020-04-19 00:00 | 2020-04-20 00:00 | 0.00 | 0.02 |
2 | 2 | 2020-04-20 00:00 | 2020-04-21 00:00 | 0.00 | 0.02 |
3 | 3 | 2020-04-21 00:00 | 2020-04-22 00:00 | 0.00 | 0.02 |
4 | 4 | 2020-04-22 00:00 | 2020-04-23 00:00 | 0.00 | 0.02 |
5 | 5 | 2020-04-23 00:00 | 2020-04-24 00:00 | 0.00 | 0.02 |
6 | 6 | 2020-04-24 00:00 | 2020-04-25 00:00 | 0.00 | 0.02 |
7 | 7 | 2020-04-25 00:00 | 2020-04-26 00:00 | 0.00 | 0.02 |
8 | 8 | 2020-04-26 00:00 | 2020-04-27 00:00 | 0.00 | 0.02 |
9 | 9 | 2020-04-27 00:00 | 2020-04-28 00:00 | 0.00 | 0.02 |
10 | 10 | 2020-04-28 00:00 | 2020-04-29 00:00 | 0.00 | 0.03 |
11 | 11 | 2020-04-29 00:00 | 2020-04-30 00:00 | 0.01 | 0.03 |
12 | 12 | 2020-04-30 00:00 | 2020-05-01 00:00 | 0.00 | 0.03 |
13 | 13 | 2020-05-01 00:00 | 2020-05-02 00:00 | 0.00 | 0.03 |
14 | 14 | 2020-05-02 00:00 | 2020-05-03 00:00 | 0.00 | 0.03 |
15 | 15 | 2020-05-03 00:00 | 2020-05-04 00:00 | 0.00 | 0.03 |
16 | 16 | 2020-05-04 00:00 | 2020-05-05 00:00 | 0.00 | 0.03 |
17 | 17 | 2020-05-05 00:00 | 2020-05-06 00:00 | 0.00 | 0.03 |
18 | 18 | 2020-05-06 00:00 | 2020-05-07 00:00 | 0.00 | 0.03 |
19 | 19 | 2020-05-07 00:00 | 2020-05-08 00:00 | 0.00 | 0.04 |
20 | 20 | 2020-05-08 00:00 | 2020-05-09 00:00 | 0.00 | 0.04 |
21 | 21 | 2020-05-09 00:00 | 2020-05-10 00:00 | 0.00 | 0.04 |
22 | 22 | 2020-05-10 00:00 | 2020-05-11 00:00 | 0.00 | 0.04 |
23 | 23 | 2020-05-11 00:00 | 2020-05-12 00:00 | 0.00 | 0.04 |
24 | 24 | 2020-05-12 00:00 | 2020-05-13 00:00 | 0.00 | 0.04 |
25 | 25 | 2020-05-13 00:00 | 2020-05-14 00:00 | 0.00 | 0.04 |
26 | 26 | 2020-05-14 00:00 | 2020-05-15 00:00 | 0.00 | 0.04 |
27 | 27 | 2020-05-15 00:00 | 2020-05-16 00:00 | 0.00 | 0.04 |
28 | 28 | 2020-05-16 00:00 | 2020-05-17 00:00 | 0.00 | 0.05 |
29 | 29 | 2020-05-17 00:00 | 2020-05-18 00:00 | 0.00 | 0.05 |
30 | 30 | 2020-05-18 00:00 | 2020-05-19 00:00 | 0.00 | 0.05 |
31 | 31 | 2020-05-19 00:00 | 2020-05-20 00:00 | 0.00 | 0.05 |
32 | 32 | 2020-05-20 00:00 | 2020-05-21 00:00 | 0.00 | 0.05 |
33 | 33 | 2020-05-21 00:00 | 2020-05-22 00:00 | 0.01 | 0.05 |
34 | 34 | 2020-05-22 00:00 | 2020-05-23 00:00 | 0.00 | 0.05 |
35 | 35 | 2020-05-23 00:00 | 2020-05-24 00:00 | 0.00 | 0.05 |
36 | 36 | 2020-05-24 00:00 | 2020-05-25 00:00 | 0.00 | 0.05 |
37 | 37 | 2020-05-25 00:00 | 2020-05-26 00:00 | 0.00 | 0.06 |
38 | 38 | 2020-05-26 00:00 | 2020-05-27 00:00 | 0.00 | 0.06 |
39 | 39 | 2020-05-27 00:00 | 2020-05-28 00:00 | 0.00 | 0.06 |
40 | 40 | 2020-05-28 00:00 | 2020-05-29 00:00 | 0.00 | 0.06 |
41 | 41 | 2020-05-29 00:00 | 2020-05-30 00:00 | 0.01 | 0.06 |
42 | 42 | 2020-05-30 00:00 | 2020-05-31 00:00 | 0.29 | 0.06 |
43 | 43 | 2020-05-31 00:00 | 2020-06-01 00:00 | 0.21 | 0.06 |
44 | 44 | 2020-06-01 00:00 | 2020-06-02 00:00 | 0.79 | 0.06 |
45 | 45 | 2020-06-02 00:00 | 2020-06-03 00:00 | 0.79 | 0.06 |
46 | 46 | 2020-06-03 00:00 | 2020-06-04 00:00 | 0.79 | 0.07 |
47 | 47 | 2020-06-04 00:00 | 2020-06-05 00:00 | 0.46 | 0.07 |
48 | 48 | 2020-06-05 00:00 | 2020-06-06 00:00 | 0.00 | 0.07 |
49 | 49 | 2020-06-06 00:00 | 2020-06-07 00:00 | 0.01 | 0.07 |
50 | 50 | 2020-06-07 00:00 | 2020-06-08 00:00 | 0.01 | 0.07 |
51 | 51 | 2020-06-08 00:00 | 2020-06-09 00:00 | 0.01 | 0.07 |
52 | 52 | 2020-06-09 00:00 | 2020-06-10 00:00 | 0.01 | 0.07 |
53 | 53 | 2020-06-10 00:00 | 2020-06-11 00:00 | 0.01 | 0.07 |
54 | 54 | 2020-06-11 00:00 | 2020-06-12 00:00 | 0.01 | 0.07 |
55 | 55 | 2020-06-12 00:00 | 2020-06-13 00:00 | 0.01 | 0.08 |
56 | 56 | 2020-06-13 00:00 | 2020-06-14 00:00 | 0.01 | 0.08 |
57 | 57 | 2020-06-14 00:00 | 2020-06-15 00:00 | 0.00 | 0.08 |
58 | 58 | 2020-06-15 00:00 | 2020-06-16 00:00 | 0.00 | 0.08 |
59 | 59 | 2020-06-16 00:00 | 2020-06-17 00:00 | 0.00 | 0.08 |
60 | 60 | 2020-06-17 00:00 | 2020-06-18 00:00 | 0.00 | 0.08 |
61 | 61 | 2020-06-18 00:00 | 2020-06-19 00:00 | 0.00 | 0.08 |
62 | 62 | 2020-06-19 00:00 | 2020-06-20 00:00 | 0.00 | 0.08 |
63 | 63 | 2020-06-20 00:00 | 2020-06-21 00:00 | 0.00 | 0.08 |
64 | 64 | 2020-06-21 00:00 | 2020-06-22 00:00 | 0.00 | 0.09 |
65 | 65 | 2020-06-22 00:00 | 2020-06-23 00:00 | 0.00 | 0.09 |
66 | 66 | 2020-06-23 00:00 | 2020-06-24 00:00 | 0.00 | 0.09 |
67 | 67 | 2020-06-24 00:00 | 2020-06-25 00:00 | 0.00 | 0.09 |
68 | 68 | 2020-06-25 00:00 | 2020-06-26 00:00 | 0.00 | 0.09 |
69 | 69 | 2020-06-26 00:00 | 2020-06-27 00:00 | 0.00 | 0.09 |
70 | 70 | 2020-06-27 00:00 | 2020-06-28 00:00 | 0.02 | 0.09 |
71 | 71 | 2020-06-28 00:00 | 2020-06-29 00:00 | 0.05 | 0.09 |
#: click on a column heading to sort on it
Name Null? Type
----------------------------------------------------------------------------------- -------- --------------------------------------------------------
TAG VARCHAR2(128)
CURRENCY VARCHAR2(4)
ENDTIMEUTC VARCHAR2(32)
SERVICENAME VARCHAR2(32)
GSIPRODUCTID VARCHAR2(8)
RESOURCENAME VARCHAR2(64)
STARTTIMEUTC VARCHAR2(32)
SUBSCRIPTIONID VARCHAR2(8)
SUBSCRIPTIONTYPE VARCHAR2(16)
SERVICEENTITLEMENTID VARCHAR2(16)
COSTS$UNITPRICE NUMBER
COSTS$OVERAGESFLAG VARCHAR2(1)
COSTS$COMPUTEDAMOUNT NUMBER
COSTS$COMPUTEDQUANTITY NUMBER
WITH t1 AS (
SELECT SUM(COSTS$COMPUTEDAMOUNT) COMPUTEDAMOUNT,
TO_TIMESTAMP(ENDTIMEUTC,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM') ENDTIMEUTC
FROM OCI360_USAGECOSTS_TAGGED_DAILY
WHERE TAG = 'ORCL:OCICompartmentPath=dbarj/compt_dev/compt_dev_app'
GROUP BY TO_TIMESTAMP(ENDTIMEUTC,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')
),
trange as (
select trunc(min(TO_TIMESTAMP(ENDTIMEUTC,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')),'HH24') min,
trunc(max(TO_TIMESTAMP(ENDTIMEUTC,'YYYY-MM-DD"T"HH24:MI:SS.FF6TZH:TZM')),'HH24') max
FROM OCI360_USAGECOSTS_TAGGED_DAILY
),
alldays as ( /* Will generate all days between Min and Max Start Time */
SELECT trunc(trange.min,'DD') + (rownum - 1) vdate,
rownum seq
FROM trange
WHERE trange.min + (rownum - 1) <= trange.max - 1 /* Skip last entry as may be incomplete. */
CONNECT BY LEVEL <= (trange.max - trange.min) + 1
),
result as (
select seq snap_id,
TO_CHAR(vdate, 'YYYY-MM-DD HH24:MI') begin_time,
TO_CHAR(vdate+1,'YYYY-MM-DD HH24:MI') end_time,
TO_CHAR(NVL(CEIL(SUM(COMPUTEDAMOUNT)*100)/100,0),'99999990D00') line1
from t1, alldays
where ENDTIMEUTC(+) >= vdate and ENDTIMEUTC(+) < vdate+1
group by seq, vdate
),
statistics as (
select REGR_SLOPE(line1,snap_id) slope,
REGR_INTERCEPT(line1,snap_id) intercept
from result
)
select snap_id,
begin_time,
end_time,
line1,
TO_CHAR(CEIL((slope*snap_id+intercept)*100)/100,'99999990D00') line2,
0 dummy_03,
0 dummy_04,
0 dummy_05,
0 dummy_06,
0 dummy_07,
0 dummy_08,
0 dummy_09,
0 dummy_10,
0 dummy_11,
0 dummy_12,
0 dummy_13,
0 dummy_14,
0 dummy_15
from result, statistics
order by snap_id;
71 rows selected.