Oracle12有了with function/procedure, 那么怎么和原来的with view共存呢?
想查oracle文档中的语法,找了半天没找到,只有摸石头过河,发现这能这样才能成功:
With
FUNCTION with_function(p_id IN NUMBER) RETURN NUMBER IS
BEGIN
RETURN p_id;
END;
x1 as (select sysdate f1 from dual),
x2 as (select sysdate f2 from dual)
SELECT with_function(100), f1,f2
FROM dual,x1,x2;
/
WITH_FUNCTION(100) F1 F2
------------------ --------- ---------
100 10-DEC-13 10-DEC-13
With
FUNCTION with_function(p_id IN NUMBER) RETURN NUMBER IS
BEGIN
RETURN p_id;
END;
x1 as (select sysdate f1 from dual),
x2 as (select sysdate f2 from dual)
SELECT with_function(100), f1,f2
FROM dual,x1,x2
/
WITH_FUNCTION(100) F1 F2
------------------ --------- ---------
100 10-DEC-13 10-DEC-13
这个只能当做PL/SQL代码,只能用/开头的单独作为语句结束,而不是分号
阅读(3503) | 评论(1) | 转发(0) |