How to simulate 32-bit signed integer overflow in PL/SQL?
Do you know how to simulate a 32-bit integer overflow in Oracle PL/SQL. For instance, 2147483647 + 1 = -2147483648 or -2147483648 - 1 = 212147483647 I tried PLS_INTEGER, but it throws an overflow exception. Perhaps you could trap the overflow exception, as in the following: DECLARE n PLS_INTEGER; addend PLS_INTEGER; NUMERIC_OVERFLOW EXCEPTION; PRAGMA EXCEPTION_INIT(NUMERIC_OVERFLOW, -1426); BEGIN n := 2147483642; addend := 6; BEGIN n := n + addend; EXCEPTION WHEN NUMERIC_OVERFLOW THEN DBMS_OUTPUT.PUT_LINE('OVERFLOW!'); n := -2147483647 + (-2147483647 + n + addend - 1); WHEN OTHERS THEN DBMS