Define integer variables : Integer « Data Type « Oracle PL / SQL






Define integer variables



SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2      width INTEGER;
  3      height INTEGER := 2;
  4      area INTEGER;
  5  BEGIN
  6      area := 6;
  7      width := area / height;
  8      DBMS_OUTPUT.PUT_LINE('width = ' || width);
  9  EXCEPTION
 10  WHEN ZERO_DIVIDE THEN
 11     DBMS_OUTPUT.PUT_LINE('Division by zero');
 12  END;
 13  /
width = 3

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL>
           
       








Related examples in the same category

1.Use ANSI Data Types when creating a table
2.Int value column
3.Use for loop statement to set value to an integer variable