0

在 SQL Developer 中,此脚本返回预期的结果集:

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')

相同的查询不在 Toad 中运行;它会产生ORA-00900: invalid SQL statement错误。

我的问题是,如何在 Toad Data Point 中运行此查询而无需添加更多代码行且无需在Bind Variables弹出窗口中重新输入值?

4

1 回答 1

0

像这样查询

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

在我的 TOAD 12.5 中运行良好。

请注意,这两个变量都应该是 VARCHAR2 (当您正在TO_DATE输入它们时),以MM-DD-YYYY格式输入。

于 2019-07-05T21:25:15.943 回答