Toad: Run plsql query without Bind Variables popup?

969 Views Asked by At

In SQL Developer this script returns the expected resultset:

define FromDate = '02-03-2019';
define ToDate = '02-05-2019';

select * from TEST_TABLE
where  test_date >= to_date('&&FromDate', 'MM-DD-YYYY')
and    test_date < to_date('&&ToDate', 'MM-DD-YYYY')

This same query does not run in Toad; it generates ORA-00900: invalid SQL statement error.

My question is, how can I run this query in Toad Data Point without adding more lines of codes and without having to re-enter the values in the Bind Variables popup?

1

There are 1 best solutions below

5
On

Query like this

select * 
from TEST_TABLE
where test_date >= to_date(:FromDate, 'MM-DD-YYYY')
  and test_date <  to_date(:ToDate  , 'MM-DD-YYYY')

runs OK in my TOAD 12.5.

Note that both variables should be VARCHAR2 (as you're TO_DATE-ing them), entered in MM-DD-YYYY format.