SQL Language (MOSC)

MOSC Banner

Using CASE to calculate a value

in SQL Language (MOSC) 8 commentsAnswered ✓

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)

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center