# Setting a Dynamic Date Range in Toad Data Point 3.2

**URL:** <https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [November 14, 2014, 11:19am UTC](https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732 "2014-11-14T11:19:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![l2evenge](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@l2evenge](https://forums.toadworld.com/u/l2evenge)\
**Post date:** [November 14, 2014, 11:19am UTC](https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732/1 "2014-11-14T11:19:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![l2evenge](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@l2evenge](https://forums.toadworld.com/u/l2evenge)\
**Post date:** [November 14, 2014, 12:35pm UTC](https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732/2 "2014-11-14T12:35:19Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![GregDavis11009](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gregdavis11009/32/122_2.png) [@GregDavis11009](https://forums.toadworld.com/u/GregDavis11009)\
**Post date:** [November 17, 2014, 9:16am UTC](https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732/3 "2014-11-17T09:16:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GregDavis11009](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gregdavis11009/32/122_2.png) [@GregDavis11009](https://forums.toadworld.com/u/GregDavis11009)\
**Post date:** [November 17, 2014, 9:27am UTC](https://forums.toadworld.com/t/setting-a-dynamic-date-range-in-toad-data-point-3-2/31732/4 "2014-11-17T09:27:39Z")

</div>

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)
