我可以在使用游标时使用WITH子句
OPEN CURSOR_NAME FOR
WITH view1 as (Select v_name from tablename),
view2 as (Select p_name from tablename2)
Select * from view1, view2;
答案 0 :(得分:1)
是的,可以在游标中使用with
子句。请查看以下示例。
DECLARE
l_cur sys_refcursor;
l_val VARCHAR2 (1000);
BEGIN
DBMS_OUTPUT.ENABLE;
OPEN l_cur FOR
WITH tab AS
(SELECT 'hello'
FROM DUAL)
SELECT *
FROM tab;
FETCH l_cur
INTO l_val;
CLOSE l_cur;
DBMS_OUTPUT.put_line (l_val);
END;
输出:hello