# | SNAP_ID | BEGIN_TIME | END_TIME |
---|---|---|---|
1 | 934 | 2020-06-19 12:00 | 2020-06-19 13:00 |
#: click on a column heading to sort on it
If this statement return lines, you may have gaps in your utilization results.
Name Null? Type
----------------------------------------------------------------------------------- -------- --------------------------------------------------------
lineItem/referenceNo VARCHAR2(4000)
lineItem/tenantId VARCHAR2(4000)
lineItem/intervalUsageStart VARCHAR2(4000)
lineItem/intervalUsageEnd VARCHAR2(4000)
product/service VARCHAR2(4000)
product/compartmentId VARCHAR2(4000)
product/compartmentName VARCHAR2(4000)
product/region VARCHAR2(4000)
product/availabilityDomain VARCHAR2(4000)
product/resourceId VARCHAR2(4000)
usage/billedQuantity VARCHAR2(4000)
usage/billedQuantityOverage VARCHAR2(4000)
cost/subscriptionId VARCHAR2(4000)
cost/productSku VARCHAR2(4000)
product/Description VARCHAR2(4000)
cost/unitPrice VARCHAR2(4000)
cost/unitPriceOverage VARCHAR2(4000)
cost/myCost VARCHAR2(4000)
cost/myCostOverage VARCHAR2(4000)
cost/currencyCode VARCHAR2(4000)
cost/billingUnitReadable VARCHAR2(4000)
cost/overageFlag VARCHAR2(4000)
lineItem/isCorrection VARCHAR2(4000)
lineItem/backreferenceNo VARCHAR2(4000)
tags/Oracle-Tags.CreatedBy VARCHAR2(4000)
tags/Oracle-Tags.CreatedOn VARCHAR2(4000)
tags/orcl-cloud.free-tier-retained VARCHAR2(4000)
WITH t1 AS (
SELECT /*+ materialize */ distinct TO_TIMESTAMP("lineItem/intervalUsageEnd",'YYYY-MM-DD"T"HH24:MI"Z"') ENDTIMEUTC
FROM OCI360_REPORTS_COST
),
trange as (
select trunc(min(ENDTIMEUTC),'HH24') min,
trunc(max(ENDTIMEUTC),'HH24') max
FROM t1
),
allhours as ( /* Will generate all hours between Min and Max Start Time */
SELECT trange.min + (rownum - 1)/24 vdate,
rownum seq
FROM trange
WHERE trange.min + (rownum - 1)/24 <= trange.max - 1/24 /* Skip last entry as may be incomplete. */
CONNECT BY LEVEL <= (trange.max - trange.min)*24 + 1
)
select seq snap_id,
TO_CHAR(vdate, 'YYYY-MM-DD HH24:MI') begin_time,
TO_CHAR(vdate+1/24,'YYYY-MM-DD HH24:MI') end_time
from t1, allhours
where ENDTIMEUTC(+) >= vdate and ENDTIMEUTC(+) < vdate+1/24
and ENDTIMEUTC is null
group by seq, vdate
order by seq;
1 rows selected.