밑에 작성한 프로시저는 늘어나는 동적쿼리를 테스트 해보기위한 프로시저입니다. 장문의 sql문을 clob 에 담아 4000바이트씩 잘라서 varchar배열에 넣은후에 배열을 합쳐서 커서 오픈 했는데요 이경우에 배열을 합쳤을때 용량이 65535 바이트를 넘기면 커서오픈이 실행되지 않습니다. clob 는 65535 이상으로 더 들어갈 수 있는데 말이죠 65535가 최대라고 한다면 바로 clob 으로 오픈할수 있는 방법이 있을까요? PROCEDURE PC_SELECT1( vi_CorpCd In VarChar2, vo_RefCur OUT RefCur, vo_IsError OUT VARCHAR2, vo_Msg OUT VARCHAR2 ) IS WRITE_CLOB CLOB; WRITE_STATEMENT VARCHAR2(4000); vm_Clob CLOB; AMOUNT BINARY_INTEGER; vm_Sql VARCHAR2(4000); vm_Cnt number; vm_i number; TYPE VAR_ARR IS TABLE OF varchar2(4000) INDEX BY VARCHAR2(4000); vm_arr VAR_ARR; READ_CLOB CLOB; CHARS_READ BINARY_INTEGER; OFFSET NUMBER DEFAULT 1; BEGIN DELETE FROM LOB_TAB; INSERT INTO LOB_TAB(ID,CHAR_LOB) VALUES(1,EMPTY_CLOB()); --쓰기시작 SELECT CHAR_LOB INTO WRITE_CLOB FROM LOB_TAB WHERE ID = 1; DBMS_LOB.OPEN(WRITE_CLOB,DBMS_LOB.LOB_READWRITE); WRITE_STATEMENT := 'SELECT '; AMOUNT := LENGTH(WRITE_STATEMENT); DBMS_LOB.WRITE(WRITE_CLOB,AMOUNT,OFFSET,WRITE_STATEMENT); FOR BASE IN ( SELECT GDS_NO FROM NT017 WHERE GDS_NO BETWEEN '10000' AND '14453' --이부분에서 용량을 조절했습니다. ) LOOP WRITE_STATEMENT := BASE.GDS_NO||' AS "'||BASE.GDS_NO||'" ,'; AMOUNT := LENGTH(WRITE_STATEMENT); DBMS_LOB.WRITEAPPEND(WRITE_CLOB,AMOUNT,WRITE_STATEMENT); END LOOP; WRITE_STATEMENT := ' ''1'' as aaa FROM NT017 WHERE GDS_NO BETWEEN ''10000'' AND ''10010'''; AMOUNT := LENGTH(WRITE_STATEMENT); DBMS_LOB.WRITEAPPEND(WRITE_CLOB,AMOUNT,WRITE_STATEMENT); DBMS_LOB.CLOSE(WRITE_CLOB); --쓰기끝 --읽기-- CHARS_READ:=4000; vm_i := 0; while (vm_i<30)loop vm_i := vm_i + 1; vm_arr(vm_i) := ' '; end loop; select ceil(length(char_lob)/4000) into vm_Cnt from lob_tab WHERE ID = 1; SELECT CHAR_LOB INTO READ_CLOB FROM LOB_TAB WHERE ID = 1; vm_i := 0; while (vm_Cnt >0)loop DBMS_LOB.READ(READ_CLOB,CHARS_READ,OFFSET+vm_i*4000,vm_Sql); vm_arr(vm_i) := vm_Sql; vm_i := vm_i + 1; vm_Cnt:=vm_Cnt-1; end loop; -- vm_arr(0) := 'select * from pt015 union all '; -- vm_arr(1) := 'select * from pt015'; -- OPEN vo_RefCur FOR vm_arr(0)|| -- vm_arr(1); -- vm_Sql := vm_Sql||' ''1'' as aaa FROM NT017 WHERE GDS_NO BETWEEN ''10000'' AND ''10010'''; -- raise_application_error(-20001,vm_arr(18)); OPEN vo_RefCur FOR vm_arr(0)|| vm_arr(1)|| vm_arr(2)|| vm_arr(3)|| vm_arr(4)|| vm_arr(5)|| vm_arr(6)|| vm_arr(7)|| vm_arr(8)|| vm_arr(9)|| vm_arr(10)|| vm_arr(11)|| vm_arr(12)|| vm_arr(13)|| vm_arr(14)|| vm_arr(15)|| vm_arr(16)|| vm_arr(17)|| vm_arr(18)||