Using CASE to calculate a value
Hi
We have the following query that we use to query the disk group details
SELECT
name group_name
, sector_size sector_size
, block_size block_size
, allocation_unit_size allocation_unit_size
, state state
, type type
, total_mb/1024 total_gb
, (total_mb/1024) - (free_mb/1024) used_gb
,usable_file_mb/1024 available_gb
, ROUND((1- ((free_mb/3)/1024) / ((total_mb/3)/1024))*100, 2) pct_used
FROM v$asm_diskgroup
where type='HIGH'
ORDER BY name
/
The pct_used formula --> ROUND((1- ((free_mb/3)/1024) / ((total_mb/3)/1024))*100, 2) pct_used
gives us correct value if TYPE='HIGH' but if TYPE='NORMAL' we need to have the following in the pct_used formula (replace 3 with 2)