日期:2014-05-17  浏览次数:21620 次

存储过程中with as的应用
我一直不知道with as能否在存储过程中使用,特此做了个实验,但是报错了,
是否是AS 的原因?

create or replace procedure andyutest
as
begin
BEGIN
DECLARE TT NUMBER;
with t
as (
select 10 AS C1 FROM DUAL;
)
SELECT C1 INTO TT
FROM T;
DBMS_OUTPUT.PUT_LINE(TT);
END;
END;


6/1      PLS-00103: Encountered the symbol "WITH" when expecting one of the following:       begin function pragma procedure subtype type <an identifier>     <a double-quoted delimited-identifier> current cursor delete     exists prior  
 
------解决方案--------------------
我怎么记得顺序应该是
declare 
begin 
end 

楼主写的是
begin 
declare 
end