Convert VARCHAR to Number implicitly : CHAR Type Convert « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL> SET ECHO ON
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2    d1    DATE;
  3    cd1   VARCHAR2(10);
  4    cd2   VARCHAR2(10);
  5    n1    NUMBER;
  6    cn1   VARCHAR2(10);
  7    cn2   VARCHAR2(10);
  8  BEGIN
  9    cn1 := '995';
 10    n1 := cn1 + .99 ;
 11
 12    DBMS_OUTPUT.PUT_LINE('CN1 = ' || cn1);
 13    DBMS_OUTPUT.PUT_LINE('N2 = ' || n1);
 14  END;
 15  /
CN1 = 995
N2 = 995.99

PL/SQL procedure successfully completed.








21.3.CHAR Type Convert
21.3.1.Convert VARCHAR to Number implicitly
21.3.2.Convert Number to VARCHAR implicitly
21.3.3.Converting a Character to an Integer Value
21.3.4.Converting a Character Formatted as Currency to an Integer Value
21.3.5.Converting VARCHAR2 Percentage Data to a Decimal Equivalent