Why do I have a zero result on this query for all non-zero rows? Do I
have to declare specifically the precision of ratio division? How do I
do that? And is there a way to make DB2 'ignore' division by zero and
just punch up a 0 result where such division is encountered so that I
can remove the where-clause?
Here's the query, I think it's very clear what I want to do:
select substr(tablespace_name, 1, 120) as TBSPC_NAME, used_pages,
free_pages, (used_pages/free_pages) as ratio
from table (snapshot_tbs_cfg ('MUTANT', -1)) as snapshot_tbs_cfg
where free_pages <0;
and here is the input set....
TBSPC_NAME USED_PAGES FREE_PAGES
---------------- -------------------- --------------------
SYSCATSPACE 0 0
TEMPSPACE1 0 0
USERSPACE1 0 0
SYSTOOLSPACE 0 0
TEMP 0 0
TABLESPACE_TS 31184 230944
SYSTOOLSTMPSPACE 0 0