0

コルズさん、こんにちは。次の「型破りな」選択をストアドプロシージャに変換する方法を誰か教えてください。

SELECT * FROM TABLE
                (parallel_dump –- this is a pipelined function which helps to create a huge file using UTL
                    (
                    CURSOR(
                    SELECT /*+ PARALLEL(s,4)*/
                    to_clob(B1)||to_clob(B2)||to_clob(B3)||to_clob(B4) AS cvs  
FROM 
(select 
(A1||…||A200) as B1,
(A201||…||A400) as B2, 
(A401||…||A600) as B3,
(A601||…||A839) as B4 from 
(
Select blabla from Dual

Union all 


select * from anytable


union all

select blablaba from DUAL  

union all

select blabla from DUAL  

)

) s),
                    'filename',
                    'DIRECTORY_NAME'
                    )
                ) nt;

「に」がどこでどのように使われるのか理解できません。いくつかのバリアントを試しましたが、proc をコンパイルできません。

4

1 に答える 1

2
create or replace procedure my_proc 
IS
begin
for rec in (
SELECT                     *
FROM TABLE (parallel_dump –- this IS a pipelined FUNCTION which helps TO CREATE a huge file USING UTL ( CURSOR
  (SELECT
    /*+ PARALLEL(s,4)*/
    to_clob(B1)
    ||to_clob(B2)
    ||to_clob(B3)
    ||to_clob(B4) AS cvs
  FROM
    (SELECT (A1
      ||…
      ||A200) AS B1,
      (A201
      ||…
      ||A400) AS B2,
      (A401
      ||…
      ||A600) AS B3,
      (A601
      ||…
      ||A839) AS B4
    FROM
      ( SELECT blabla FROM Dual
      UNION ALL
      SELECT * FROM anytable
      UNION ALL
      SELECT blablaba FROM DUAL
      UNION ALL
      SELECT blabla FROM DUAL
      )
    ) s
  ), 'filename', 'DIRECTORY_NAME' ) ) nt
  )
  LOOP
   -- do whatever you want with the data for example:
   dbms_output.put_line('value of col1 ' || rec.col1);
  END LOOP;
END;
/
于 2012-08-14T14:24:30.690 に答える