Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

introduce increment/decrement operator (++/--) in SQL and PL/SQL for integer types

TPD-OpitzApr 3 2015 — edited Jan 11 2016

I'd like to have increment/decrement operator (++/--) in SQL and PL/SQL.for integer types

in SQL this Operator should be available for updates like:

UPDATE some_table

SET integer_arrtibute ++,

,another_integer_Attribute--,

where ...

leading Operator or combination with assingments should not be allowed.

In PL/SQL the Operator should work as in Java, mening that the leading Operator is evalueated bevore an assingment and the trailing Operator is evaluated after an assingment:

declare

  integer v_test1 := 1;
  integer v_test2 := 5;

begin

v_test2 := v_test1++;

if(6=v_test2) then dbms_Output.put_line('success'); end if;

if(2=v_test1) then dbms_Output.put_line('success'); end if;

v_test2 := ++v_test1;

if(9=v_test2) then dbms_Output.put_line('success'); end if;

if(3=v_test1) then dbms_Output.put_line('success'); end if;

end;

bye

TPD

Comments
Post Details
Added on Apr 3 2015
20 comments
16,174 views