Toad World® Forums

Setting a Dynamic Date Range in Toad Data Point 3.2

I am working on getting data pulled from an Oracle server. Currently, I am able to pull yesterdays data very easily. However, due to some security settings at my company I cannot have Toad Automate the data pull over the weekends. That means I need to come up with a query to pull over a dynamic date range and set that to run every Monday morning. I’ve seen many solutions that appeared promising, but none of them are compatible with Toad Data Point 3.2 as far as I can tell.

I would be looking to pull the data from last Friday through the end of Sunday.

Thanks in advance!

After continued searching I found a solution that works for me. Much more simple than I expected.

(“TABLE”.“DATE_KEY” BETWEEN TRUNC (SYSDATE) - 3

AND TRUNC (SYSDATE) - 1)

You can also use date variables in Toad but they can be a little tricky in some versions of Toad. I can’t remember if 3.2 allows you set the data type of the variable. 3.6 will let you. I remember having use the date variable as text and use cast(#date_Variable# as Date) in a past version.

You could also use:

(“TABLE”.“DATE_KEY” BETWEEN Case to_char(sysdate, ‘D’)

When 2 Then TRUNC (SYSDATE) - 3 --Mondays only

Else TRUNC (SYSDATE) - 1 --All other days

End

AND TRUNC (SYSDATE) - 1)