如何在 Netezza 中 运行 变量?

How to run variable in Netezza?

我试图在 Aginity for Netezza 中 运行 一些代码而不将其放入存储过程中,但我无法获得正确的语法。下面是一些示例代码。

\set STARTDATE '2016-01-19 00:00:00';
\set ENDDATE '2016-01-19 23:59:59';
select * from LOG where create_time between :STARTDATE and :ENDDATE;

错误是这样的:

error ^ found ":" (at char 60) expecting an identifier found a keyword

试试这个。

set $startdate = '2016-01-19 00:00:00';
set $enddate = '2016-01-19 23:59:59';
select * from LOG where create_time between $startdate and $enddate;