# Prompted Query and Bind Variables

**URL:** <https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [August 20, 2008, 12:08pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890 "2008-08-20T12:08:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gtrmikegmail.com](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gtrmikegmail.com/32/48_2.png) [@gtrmikegmail.com](https://forums.toadworld.com/u/gtrmikegmail.com)\
**Post date:** [August 20, 2008, 12:08pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890/1 "2008-08-20T12:08:39Z")

</div>

I have built a query with inline SELECTS where I want to prompt the user for 2 Dates. I will then take use variables in other queries.

Here’s the gist of my query:

–REGION Get End Date  
SELECT a.BEG\_DT, FACT.TIME\_KEY AS END\_DT  
FROM INSIGHTADM.FACT FACT,  
–REGION Get Begin Date  
(SELECT FACT.TIME\_KEY AS BEG\_DT  
FROM INSIGHTADM.FACT FACT  
WHERE (FACT.TIME\_KEY = ?)  
GROUP BY FACT.TIME\_KEY)a  
–END REGION  
WHERE (FACT.TIME\_KEY = ?)  
GROUP BY a.BEG\_DT, FACT.TIME\_KEY

–END REGION

When the user gets prompted, they get a pop-up box that shows a table view with 2 rows. The Name showing for the 2 variables are f0 and f1. Is there any way to pass a Name Alias to the user instead of the “f0” and “f1”?

Thanks!  
 ![image001.png](https://global.discourse-cdn.com/quest/original/2X/c/c486344808158bcc6c0438b2b1ac025117d52027.png)

---

<div class="post-metadata">

**Author:** ![gtrmikegmail.com](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gtrmikegmail.com/32/48_2.png) [@gtrmikegmail.com](https://forums.toadworld.com/u/gtrmikegmail.com)\
**Post date:** [August 20, 2008, 12:18pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890/2 "2008-08-20T12:18:54Z")

</div>

If I use the (:TIME\_KEY) approach, then I get an “ORA-00920: invalid relational operator” error

---

<div class="post-metadata">

**Author:** ![Henrik\_Johnson](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/henrik_johnson/32/14_2.png) [@Henrik\_Johnson](https://forums.toadworld.com/u/Henrik_Johnson)\
**Post date:** [August 20, 2008, 12:21pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890/3 "2008-08-20T12:21:35Z")

</div>

This should do what you are asking for:

–REGION Get End Date  
SELECT a.BEG\_DT, FACT.TIME\_KEY AS END\_DT  
FROM INSIGHTADM.FACT FACT,  
–REGION Get Begin Date  
(SELECT FACT.TIME\_KEY AS BEG\_DT  
FROM INSIGHTADM.FACT FACT  
WHERE (FACT.TIME\_KEY = :name\_one)  
GROUP BY FACT.TIME\_KEY)a  
–END REGION  
WHERE (FACT.TIME\_KEY = :name\_two)  
GROUP BY a.BEG\_DT, FACT.TIME\_KEY  
–END REGION

It will ask for name\_one or name\_two.

/Mauritz

---

<div class="post-metadata">

**Author:** ![Henrik\_Johnson](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/henrik_johnson/32/14_2.png) [@Henrik\_Johnson](https://forums.toadworld.com/u/Henrik_Johnson)\
**Post date:** [August 20, 2008, 12:22pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890/4 "2008-08-20T12:22:05Z")

</div>

That is odd. They should be the same.

/Mauritz

---

<div class="post-metadata">

**Author:** ![gtrmikegmail.com](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/gtrmikegmail.com/32/48_2.png) [@gtrmikegmail.com](https://forums.toadworld.com/u/gtrmikegmail.com)\
**Post date:** [August 20, 2008, 12:24pm UTC](https://forums.toadworld.com/t/prompted-query-and-bind-variables/5890/5 "2008-08-20T12:24:51Z")

</div>

You, my friend…ROCK!!!

That worked PERFECTLY!

Thanks for such a quick response!

Mike
