PL/SQL (MOSC)

MOSC Banner

ORA-06502: PL/SQL: numeric or value error

edited Mar 31, 2020 11:37AM in PL/SQL (MOSC) 12 commentsAnswered

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

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