您好我正在尝试声明一个要在 Oracle SQL 选择查询中使用的变量,如下所示:
DECLARE
myDate DATE;
BEGIN
SELECT Source as "Source", DT as "Date", Status as "Status", COALESCE("Count", 0) as "Count"
FROM (Huge SubQuery that includes many WHERE date between x and y);
END;
我需要使用 myDate 进行查询,因此每次运行查询时我都不必在 10 个地方更新它。基本上它只是用于声明一个变量,该变量可以在多个地方的 where date is between 子句中使用。