| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: return clob to java program
Ted McCabe wrote:
> Have you looked in ORACLE_HOME\rdbms\demo\lobs\java\*. I don't use it but I > know it's there > > HTH > tED > "Vijays" <vbaskar_at_indiatimes.com> wrote in message > news:65a7c6c4.0402132342.7ceba782_at_posting.google.com... >
The solution, if I understand the OP's problem, can be solved by using the DBMS_SQL package's ability to execute a PL/SQL table.
The following stored procedure will execute any PL/SQL anonymous block thrown at it no matter the size up to 4GB.
CREATE OR REPLACE PROCEDURE execute_plsql_block( plsql_code_block CLOB) IS
ds_cur PLS_INTEGER := DBMS_SQL.OPEN_CURSOR; sql_table DBMS_SQL.VARCHAR2S;
c_buf_len CONSTANT BINARY_INTEGER := 256; v_accum INTEGER := 0; v_beg INTEGER := 1; v_end INTEGER := 256; v_loblen PLS_INTEGER; v_RetVal PLS_INTEGER; ---------------------------
BEGIN
RETURN DBMS_LOB.SUBSTR(clob_in, len_in, off_in);
END next_row;
BEGIN
v_loblen := DBMS_LOB.GETLENGTH(plsql_code_block);
LOOP
sql_table(NVL(sql_table.LAST, 0) + 1) :=
next_row(plsql_code_block, v_end, v_beg);
v_beg := v_beg + c_BUF_LEN;
v_accum := v_accum + v_end;
IF v_accum >= v_loblen THEN
EXIT;
END IF;
END execute_plsql_block;
/
It is a demo from the University of Washington Advanced Oracle class and if incorporated into a production environment could use a bit of clean up and some error handling.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Sun Feb 15 2004 - 11:58:48 CST
![]() |
![]() |