【发布时间】:2014-04-01 07:44:00
【问题描述】:
我正在尝试声明一个表示日期的变量, 我的代码如下所示:
declare
mydate date;
begin
select TO_DATE('01.01.2014 00:00:00','DD.MM.YYYY HH24:MI:SS') into mydate from dual;
end;
--then comes code like this, the code below works when there is no declaration:
WITH *** AS
(
),
*** AS
(
)
SELECT ***
FROM ***
GROUP BY ***
UNION ALL
SELECT ***
FROM ***
WHERE ***
上面的代码不起作用。 好吧,我不是 SQL 专家,所以有什么提示吗? 我还通过stackoverflow搜索但没有找到答案。
错误日志(没那么有用):
ORA-06550: line 8, column 1:
PLS-00103: found symbol "WITH"
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
谢谢!
【问题讨论】:
-
请发布错误
-
我感觉你没有向我们展示你正在运行的整个代码。
-
您发布的代码不是有效的 SQL。删除测试代码,它会工作。
-
嗯,没有测试代码.. 但我不允许显示所有代码,所以我只是粘贴了其中没有数据的确切结构.. 代码顶部的声明是我需要运行的,因为我需要稍后在代码中使用该变量
标签: sql oracle date variables declare