Categories
- All Categories
- 150 Oracle Analytics News
- 28 Oracle Analytics Videos
- 14.7K Oracle Analytics Forums
- 5.7K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 54 Oracle Analytics Trainings
- 12 Oracle Analytics Data Visualizations Challenge
- 4 Oracle Analytics Career
- 2 Oracle Analytics Industry
- Find Partners
- For Partners
Problem with adding days in a date(sql)

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:
- Date
- 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
Comments
-
Hi,
I think it works as designed.Look here; http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions011.htm#SQLRF00603
Thanks,
Janardhan0 -
why don't you translate 8.9 months to 267 days?.... that way you can do:
TIMESTAMPADD(SQL_TSI_DAY ,267, CURRENT_DATE) -> This adds 267 days to today's date.
I hope this helps.
Jorge O.
0 -
Thanks for the response
@Jonardhan, So does this mean is totally not posible to add a decimal number of months to a date in BI publisher?
@Jorge O, BI Publisher does not accept TIMESTAMPADD() function ,this function is ONLY accepted in OTBI work area,and converting months todays Im facing a problem with multiplication since the number of days in all months is not fixed.
Thanks,
Saswati
0