Oracle Transactional Business Intelligence

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Problem with adding days in a date(sql)

173
Views
3
Comments

Summary

Problem with adding days in a date (sql)

Content

Hi All,

I’m building a bi report and I have the following problem when building the data model.

Oracle provides ADD_MONTHS() function to use when adding duration to a date the function takes two parameters:

  1. Date
  2. Integer                                                                                                                                                              

i.e. ADD_MONTHS(28- Feb-2017,5) 

More over if you directly add a number to a date like (‘23 - Mar – 2017’)+ 40 this is automatically taken as adding 40 days to that date.

What can I do if the duration I want to add is in a decimal value e.g. 8.9 months because the ADD_MONTHS() function fail in this case?

 

 Since the duration is not an integer so I'm failing to get a precise value in this case

8.9 will be rounded to 8 and it will add 8 months instead of 8.9 months.

 

 

Clear Question

How to add a decimal duration value of months using add_months() function and get a precise answer when building a data model?

 

Thanks,

Saswati Banik

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

Welcome!

It looks like you're new here. Sign in or register to get started.