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






SQL>
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    cn2 := n1;
 12
 13    DBMS_OUTPUT.PUT_LINE('CN1 = ' || cn1);
 14    DBMS_OUTPUT.PUT_LINE('N2 = ' || n1);
 15    DBMS_OUTPUT.PUT_LINE('CN2 = ' || cn2);
 16  END;
 17  /
CN1 = 995
N2 = 995.99
CN2 = 995.99

PL/SQL procedure successfully completed.

SQL>
SQL>








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