Attempt to assign a single white space to a number. : Convert to Number « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL>
SQL> SET SERVEROUTPUT ON SIZE 1000000
SQL>
SQL> -- Build an anonymous block that will trigger an error.
SQL> DECLARE
  2    -- Define local variable.
  3    my_string         VARCHAR2(1) := ' ';
  4    my_number         NUMBER;
  5
  6  BEGIN
  7    my_number := TO_NUMBER(my_string);
  8
  9  END;
 10  /
DECLARE
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 7


SQL>








21.15.Convert to Number
21.15.1.Use TO_NUMBER to assign value to NATURAL type variable
21.15.2.Get value from different parts of a date using TO_NUMBER function
21.15.3.Attempt to assign a single white space to a number.