Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

utl_file.put_line throws exception when size of the buffer exceeds 32k.

Satyam ReddyOct 27 2010 — edited Oct 27 2010
Hi,

Utl_file.Put_Line procedure throws and error when the buffer size increases 32k . Can i have any other alternate for this to write the buffer content to an external file
. THe table structure along with the codes goes like this


Table Definition
CREATE TABLE CLARITY_RESPONSE_LOG
(
  REQUEST_CODE   NUMBER,
  RESPONSE_FILE  blob,
  DATE_CRATED    DATE                           NOT NULL,
  CREATED_BY     NUMBER                         NOT NULL,
  UPDATED_BY     NUMBER                         DEFAULT 1,
  DATE_UPDATED   VARCHAR2(20 BYTE)              DEFAULT SYSDATE
)
/ 
code to write to an external file goes something like this
DECLARE
        v_file UTL_FILE.FILE_TYPE;
        v_filename      VARCHAR2 (200);
        v_delimitedchar CHAR (1);
BEGIN
        v_delimitedchar := CHR (124);
        v_filename      := 'store_response_xml.txt';
        v_file          := UTL_FILE.FOPEN ('CWF_DATA_EXTRACTS', v_filename, 'W');
        UTL_FILE.PUT_LINE (v_file, 'store_response_xml' );
        FOR store_response IN
        (SELECT XMLTYPE (response_file, NLS_CHARSET_ID ('char_cs')).getclobval () AS store_Respone_xml
        FROM    CLARITY_RESPONSE_LOG
        WHERE   TRUNC(date_crated ) = TRUNC(SYSDATE-1)
        )
        LOOP
                UTL_FILE.PUT_LINE (v_file, store_response.store_Respone_xml);
        END LOOP;
        UTL_FILE.FCLOSE(v_file);
END ;
we are getting the following error:
ORA-06502: PL/SQL: numeric or value error
when the size of the buffer exceeds 32k


Please advise
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2010
Added on Oct 27 2010
7 comments
1,299 views