March 19, 2014

Don't use INC and DEC in PL/SQL Libraries

In my oldest PL/SQL-Library in Forms 4 my first procedures were:

PROCEDURE Inc (P_Number IN OUT NUMBER) IS
BEGIN
  P_Number := P_Number + 1;
END;

PROCEDURE Dec (P_Number IN OUT NUMBER) IS
BEGIN
  P_Number := P_Number - 1;
END;

In some variations with one or two parameters I used this Increment and Decrement since 20 years! Without having trouble in all the days.

Now I found out, that DEC isn't working in newer Oracle Forms versions...

And why? Oracle created in PL/SQL a new SUBTYPE of DECIMAL and it is called "DEC". So you can use it in this way:
DECLARE
  V_Value   DEC;
BEGIN
... 
 
And this behaviour kills my procedure in the PL/SQL-Library :-(
All other languages know INC and DEC for incrementing and decrementing. Not Oracle!

Be careful when creating new functions which you want to use for a long time :-)
Gerd