Negative Parameters in Oracle Functions

January 8th, 2009 No Comments   Posted in Oracle Tip

I don’t see a lot of example of using negative values in Oracle functions. I am sure seasoned Oracle professionals are well aware of this functionalty, but are beginners?

Did you know when you use the function ADD_MONTHS you can pass in a negative number?

select add_months('01-Aug-03', 3) from dual;

would return ’01-Nov-03′, however

select add_months('01-Aug-03', -3) from dual;

would return ’01-May-03′

There many built-in Oracle functions that support negative values. Try SUBSTR and see what the results are.