hi all,
i have a script which shows some kinda percentage of weekly activity from
summary table but i'm confused by big numbers that come out, heres the sql >
select activity, cast(sum(affected) as integer)as "Attempts",
cast(sum(failed) as integer) as "Failed", cast((1-(cast(sum(failed) as
decimal(18,3))/sum(affected)))*100 as decimal(8,2)) as "% Success" from
summary where start_time>timestamp(current_date-8 day,'00:00:00') group by
activity
my output looks like that >
ACTIVITY Attempts Failed % Success
------------------ ----------- ----------- ----------
ARCHIVE 48918 0 100.00
BACKUP 1423353 55 99.99
EXPIRATION 1223316 0 100.00
FULL_DBBACKUP 51254126 0 100.00
MIGRATION 754404 0 100.00
RECLAMATION 349309 189 99.94
RESTORE 15325 0 100.00
RETRIEVE 2 0 100.00
STGPOOL BACKUP 649593 0 100.00
ANR2947E Division by zero was detected for operator '/'.
|
...............................V...............................
t(sum(failed) as decimal(18,3))/sum(affected)))*100 as decimal(
the error is okay. but for instance FULL_DBBACKUP to have 51254126 attempts
? hmmm .... surely the sql has to be rewritten ... huh ?
thanks on answers !
goran konjich
senior unix systems admin
vipnet
-----------------------------
TSM 5.2.2.2
AIX 5.2 ML02
LTO3584
2109 FC
|