BusinessObjects Board

Year Month Format

In the where clause of my derived query . I have to include last month condition ,last month values in the column will be in the form of year and month .This is the monthly report so it runs every last month .

how to write the below example in format of date function .
My data base is oracle. Here is the example syntax :-

Period ='200911'

thanks


89sthi (BOB member since 2009-06-24)

Hi,

Try the following:

period = to_char(add_months(sysdate,-1),'yyyymm')

Marek Chladny :slovakia: (BOB member since 2003-11-27)

It worked .thanks Mark


89sthi (BOB member since 2009-06-24)

for better performance try below code.

period = to_char(trunc(sysdate,'mm')-1,'yyyymm')

Rakesh_K :india: (BOB member since 2007-12-11)

Thats a great find

never knew it would improve the data fethcing


Disha :uk: (BOB member since 2007-05-23)

Hi Rakesh,

Would you please explain why you think that the performance will be better? I am just curious…

I am not an Oracle DBA so I can’t say whether the first formula or the second one performs better. But my intuition tells me that in my formula there is 1 less operations/functions than in yours. So my assumption is that it should be faster. But I may be wrong :slight_smile:


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Hi Marek,

please check this out. https://bobj-board.org/t/139560


Rakesh_K :india: (BOB member since 2007-12-11)

Yes? And? I am not getting the point :?


Marek Chladny :slovakia: (BOB member since 2003-11-27)

From a performance point of view there is no difference IMHO.


Andreas :de: (BOB member since 2002-06-20)