Cause:
The error ORA-06052: PL/SQL: numeric or value error would be found when using for loop on the type collection object, as shown below, and the collection is empty:
FOR i IN type_variable.FIRST..t_variable.LAST LOOP
     ----your code 
End Loop ;
When the collection is not empty, error ORA-06052: PL/SQL: numeric or value error would not be found.
This is because FIRST and LAST return the first and last (smallest and largest) index numbers in a collection that uses integer subscripts. 
Solution:
Use  FOR i IN 1..t_variable.count instead of FOR i IN type_variable.FIRST..t_variable.LAST , and also apply exception block.
BEGIN
      FOR i IN 1..t_variable.count
           ----your code 
      End Loop;
EXCEPTION WHEN OTHERS
     -- error handling code 
END; 
Blast from the Past: I Don't Like Your Examples!
                      -
                    
 Originally written in 2000, I thought you might like to check this out in 
2016. 
I Don't Like Your Examples! 10/11/2000 
I have been writing books about t...
9 years ago






 
0 comments:
Post a Comment