Please explain why the error is not intercepted at compile time, but only occurs during the execution of the procedure. Where is the logic? Or is it caused by some kind of necessity?

create or replace procedure tt is a varchar2(10) := '-6502 - ORA-06502: PL/SQL: : character string buffer too small ошибка числа или значения'; begin null; end; begin tt; end; 
  • one
    The fact is that during compilation the assignment of a string to a variable is not performed. Attempting to place a string in the variable a will only occur when the procedure starts, so the error is thrown during the start. - Viktorov
  • @Viktorov: That is, it is assumed that there may be a dynamic formation of a value (say, depending on the parameter) and it does not make sense to check at compile time? Or how can this be caused, in your opinion? - Anatoly Ernst
  • one
    It is not necessary to assign a constant value. You can assign the result returned by the function. Which generally can take value from a DB. And it should be taken at runtime - Mike

0