ORA-06502: PL/SQL: numeric or value error
hi all,
i want to implement a procedure that automatically add space at the oracle tablespace when this one is under threshold,
but when the curson not found any tablespace the procedure respond ORA-06502: PL/SQL: numeric or value error.
set serveroutput on lines 300
DECLARE
CURSOR c1 IS select tablespace_name Tbs_name,
round((sum(max_mb) - (sum(total_mb)-sum(free_mb)))/sum(max_mb) *100) Pct_Free
from (select tablespace_name,
sum(bytes)/1024/1024 free_mb,
0 total_mb,
0 max_mb
from DBA_FREE_SPACE
group by tablespace_name
union
select tablespace_name,
0 current_mb,
sum(bytes)/1024/1024 total_mb,
sum(decode(maxbytes, 0, bytes, maxbytes))/1024/1024 max_mb