JDev

Code, oracleNovember 9, 2007 4:03 pm

If your date is of DATE type, you can change the date in Oracle as follows:

select myDateField +1 from myTable : This adds one day to the selected date

select myDateField +(1/24) from myTable : This adds one hour to the selected date 

select myDateField +(1/(24*60)) from myTable : This adds one minute  to the selected date

select myDateField +(1/(24*60*60)) from myTable : This adds one second to the selected date

Code, oracleSeptember 5, 2007 8:06 pm

If you have division operations in your sql, you make encounter  divide by zero errors.

To avoid this type of errors, you may want to use the Oracle decode function.

For example instead of select fld1/fld2 from myTable use the following:

select decode(fld2,0,0, fld1/fld2) from myTable.

This is equivalent to the following:

if fld2 equals 0, select 0 

else select fld1/fld2