# Is there any way to declare variable in Dremio

**URL:** <https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601>\
**Category:** Uncategorized\
**Created:** [August 30, 2022, 10:46am UTC](https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601 "2022-08-30T10:46:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sauku](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@sauku](https://community.dremio.com/u/sauku)\
**Post date:** [August 30, 2022, 10:46am UTC](https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601/1 "2022-08-30T10:46:31Z")

</div>

Is there any way to declare variable and temp table in Dremio?

Does dremio support “Declare” keyword!!

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [September 30, 2022, 10:24am UTC](https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601/2 "2022-09-30T10:24:38Z")

</div>

@sauku Not yet supported

---

<div class="post-metadata">

**Author:** ![isabella.gagner](https://avatars.discourse-cdn.com/v4/letter/i/22d042/32.png) [@isabella.gagner](https://community.dremio.com/u/isabella.gagner)\
**Post date:** [August 19, 2024, 10:44am UTC](https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601/3 "2024-08-19T10:44:08Z")

</div>

Is it still not supported? It would be immensely helpful in some cases where more complex transformation of columns are needed.

---

<div class="post-metadata">

**Author:** ![Benny\_Chow](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/benny_chow/32/5527_2.png) [@Benny\_Chow](https://community.dremio.com/u/Benny_Chow)\
**Post date:** [October 4, 2024, 10:33pm UTC](https://community.dremio.com/t/is-there-any-way-to-declare-variable-in-dremio/9601/4 "2024-10-04T22:33:04Z")

</div>

You can basically achieve the same with a scalar UDF like this:

```auto
create or replace function "variables".daysback() returns int return select 7;

```

Then, you can use this function in a WHERE clause like:

```auto
"timestamp" > DATE_ADD(now(), -"variables".daysback())

```
