DBMS_LOB problem

Hi,
I am trying to load an xml file into my xmltable by using one user defined function called "getClobDocument".
Here is the function source code.
create or replace function getClobDocument(
filename in varchar2,
charset in varchar2 default NULL)
return CLOB deterministic
is
file bfile := bfilename('XMLDIR',filename);
charContent CLOB := ' ';
targetFile bfile;
lang_ctx number := DBMS_LOB.default_lang_ctx;
charset_id number := 0;
src_offset number := 1 ;
dst_offset number := 1 ;
warning number;
begin
     dbms_output.put_line('file_name '||filename);
if charset is not null then
charset_id := NLS_CHARSET_ID(charset);
end if;
targetFile := file;
dbms_output.put_line( DBMS_LOB.getLength(targetFile));
DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
DBMS_LOB.LOADCLOBFROMFILE(charContent, targetFile,
DBMS_LOB.getLength(targetFile), src_offset, dst_offset,
charset_id, lang_ctx,warning);
DBMS_LOB.fileclose(targetFile);
dbms_output.put_line('char_content '||charContent);
return charContent;
end;
I inserted an xml file called po.xml into the xml tabel .But i selected the data from xml table only one line is isplayed.
The rest of the xml file is not inserted into the xml table.
I am also getting the following error.
"PL/SQL: numeric or value error: host bind array too small"
can anybody tell the reason for it.
cheers
RRK

Just for the sake of clarification ... What value are you specifying for p_dir variable?
It should be a directory object created in the database.
It can be created with a command like
CREATE OR REPLACE DIRECTORY BFILE_DIR AS 'e:\middle-east\ssm';
and the user who is going to call the function should have read access on this directory object which can be granted with a command like
grant read on directory BFILE_DIR to FUNCTIONCALLINGUSER;
I hope this helps with what you are trying
Best Regards

Similar Messages

  • Nobody can solve this DBMS_LOB problem:

    I want to upload text file to ftp server but when i open file mcx.txt which is in e:\middle-east\ssm dmbs_lob.fileopen() function give error. edit e:\middle-east\ssm\mcx.txt; command also open this text file properly.
    ORA-22285: non-existent directory or file for FILEOPEN operation
    ORA-06512: at "SYS.DBMS_LOB", line 523
    ORA-06512: at "SCOTT.FTP", line 128
    ORA-06512: at "SCOTT.FTP", line 355
    ORA-06512: at line 7
    FUNCTION get_local_ascii_data (p_dir IN VARCHAR2,
    p_file IN VARCHAR2)
    RETURN CLOB IS
    l_bfile BFILE;
    l_data CLOB;
    BEGIN
    DBMS_LOB.createtemporary (lob_loc => l_data,
    cache => TRUE,
    dur => DBMS_LOB.call);
    l_bfile := BFILENAME(p_dir, p_file);
    DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
    DBMS_LOB.loadfromfile(l_data, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    RETURN l_data;
    END;

    Just for the sake of clarification ... What value are you specifying for p_dir variable?
    It should be a directory object created in the database.
    It can be created with a command like
    CREATE OR REPLACE DIRECTORY BFILE_DIR AS 'e:\middle-east\ssm';
    and the user who is going to call the function should have read access on this directory object which can be granted with a command like
    grant read on directory BFILE_DIR to FUNCTIONCALLINGUSER;
    I hope this helps with what you are trying
    Best Regards

  • Dbms_lob and line size problem

    Hi,
    below is a simple function which returns a CLOB.
    When I call this function from sqlplus and spool the result in a
    file via the SPOOL command I get a line break after 80 characters.
    When I replace in the function the CLOB type with a VARCHAR2 type
    the whole TESTSTRING is printed on ONE line.
    I do specify 'SET LINESIZE 200' in both cases and the length of
    TESTSTRING is smaller than 200 characters.
    How can I increase the line size for the CLOB case ?
    CREATE OR REPLACE FUNCTION GetSimple (
    RETURN CLOB
    IS
    RESULT CLOB;
    TESTSTRING CONSTANT VARCHAR2(4000) := '123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_AFTER_LINEBREAK' ;
    BEGIN
    -- create CLOB for RETURN
    dbms_lob.createtemporary(RESULT, TRUE);
    dbms_lob.writeappend(RESULT, length(TESTSTRING), TESTSTRING);
    RETURN RESULT;
    END GetSimple;
    /

    problem solved !
    I had to add
    SET LONGCHUNKSIZE 4096;
    default is 80

  • File content retrive/view problem using DBMS_LOB...?

    Below this procedure working fine but getting buffer length/file content display problem...
    CREATE OR REPLACE Procedure READ_FILE_LOB_tmp IS
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    l_loc BFILE;
    l_pos NUMBER := 1;
    l_sum BINARY_INTEGER := 0;
    l_buf VARCHAR2(400);
    l_end NUMBER;
    l_getlength NUMBER;
    l_ret BOOLEAN := FALSE;
    BEGIN
    l_loc := BFILENAME(l_dir, l_fil);
    l_getlength := DBMS_LOB.getlength(l_loc);
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    IF l_end >= l_getlength THEN
    EXIT;
    END IF;
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    END IF;
    END;
    My file content:
    Test Content1
    Test Content2
    Test Content3
    Test Content4
    Test Content5
    When i run this procedure, get the output like below format:
    Test Content1
    Test Content2
    Test Content3
    Test Content4
    Test Content5
    But I want to display as per file content format...

    I changed the code like...
    CREATE OR REPLACE Procedure READ_FILE_LOB IS
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    l_loc BFILE;
    l_pos NUMBER := 1;
    l_sum BINARY_INTEGER := 0;
    l_buf VARCHAR2(4000);
    l_end NUMBER;
    l_ret BOOLEAN := FALSE;
    l_getlength NUMBER;
    BEGIN
    l_loc := BFILENAME(l_dir, l_fil);
    l_getlength := DBMS_LOB.getlength(l_loc);
    --dbms_output.put_line(l_getlength);
    If l_getlength > 0 then
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    IF l_end = 0 THEN
    l_sum := l_getlength - l_pos + 1;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    EXIT;
    END IF;
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    DBMS_LOB.TRIM(l_buf, (l_sum * 2) - 2);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    Now its working fine with my format

  • Problem with BLOB fields (DBMS_LOB)

    I want to read a word document from hard disc and save it into a BLOB field with using DBMS_LOB package. but when using it I always receive error "Invalid LOB locator specified" even I use oracle examples.
    I use FormBuilder 6.0.
    How can I do this. plz give me a code.
    Thanks so much

    >
    help plzzz
    >
    If you want help in the forum you need to use English when you post.
    You also need to actually ask a question or present the issue that you need help with. Just saying you nave a problem and then posting code isn't sufficient.
    Please edit your post and provide the English version of your code, comments, error messages and your action question or issue.

  • Problem with DBMS_LOB.

    Hi, I am working with Oracle XE, I created a table with the following structure:
    CREATE TABLE "HR". EMPLOYEE_DOCUMENTS "
    "NUM_DOCUMENS" ENABLE NUMBER NOT NULL,
    "EMPLOYEE_COD" NUMBER (6.0) NOT NULL ENABLE,
    "TIPO_DOCUMENTO" VARCHAR2 (12 BYTE) NOT NULL ENABLE,
    "GENERADO_EL" DATE NOT NULL ENABLE,
    "DOCUMENTO_BLOB" BLOB,
    "DOCS8_CLOBS" CLOB,
    CONSTRAINT "EMPLOYEE_DOCUMENTS_PK" PRIMARY KEY ( "NUM_DOCUMENS")
    In the field CLOB stored as a text as follows:
    A person who carries the card. # for the use of the credential # pursued by the law.
    With DBMS_LOB, replacing the characters # content in the field CLOB by the value 1306958172, but the text that remains the last # concatenates and not get results like this:
    A person who carries the card. 1306958172 for the use of the credential 1306958172 pur
    One more question, as can assign field contents CLOb the type BLOB field to save as a Word document, an example please.
    Tahnk.
    Roberto.

    In that place of my Store Procedure:
    declare
    clobs1 CLOB;
    clobs2 CLOB;
    BLOBS blob;
    clobs_aux CLOB;
    valor number;
    cadena varchar2(4000);
    nposicion number;
    ncontar number:=1;
    begin
    select docs8_clobs, documento_blob into clobs1,blobs
    from hr.EMPLOYEE_DOCUMENTS
    where hr.EMPLOYEE_DOCUMENTS.NUM_DOCUMENS=12812;
    valor:=DBMS_LOB.INSTR(CLOBS1,'#',1,ncontar);
    clobs_aux:=clobs1;
    while valor<>0 loop
    nposicion:=valor+1;
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(VALOR));
    clobs2:=DBMS_LOB.SUBSTR(clobs_aux,valor-1,1);
    clobs2:=clobs2||' '||to_clob('1306958172');
    clobs2:=clobs2||' '||DBMS_LOB.SUBSTR(clobs_aux,nposicion,nposicion);
    CLOBS_AUX:=CLOBS2;
    if ncontar>=1 then
    update hr.EMPLOYEE_DOCUMENTS
    set docs8_clobs=clobs_aux
    where num_documens=12812;
    commit;
    end if;
    --Recuperar campo CLOB actualizado.
    select docs8_clobs, documento_blob into clobs1,blobs
    from hr.EMPLOYEE_DOCUMENTS
    where hr.EMPLOYEE_DOCUMENTS.NUM_DOCUMENS=12812;
    CLOBS_AUX:=CLOBS1;
    valor:=DBMS_LOB.INSTR(CLOBS_AUX,'#',1,ncontar);
    ncontar:=ncontar+1;
    end loop;
    end;
    Roberto.

  • Problem with DBMS_LOB.SUBSTR

    Hi,
    i want to encode a BLOB into BASE64_ENCODE.
    Here my PL/SQL function:
    FUNCTION encodeBlob2Base64(pBlobIn IN BLOB)
    RETURN BLOB
    IS
    vAmount PLS_INTEGER := 20000;
    vBase64Blob BLOB;
    vBlobIn BLOB;
    vOffset PLS_INTEGER := 1;
    BEGIN
    vBlobIn := pBlobIn;
    dbms_lob.createtemporary(lob_loc => vBase64Blob, CACHE => FALSE);
    LOOP
    dbms_lob.append(dest_lob => vBase64Blob,
    src_lob => utl_encode.base64_encode(r =>
    dbms_lob.substr(lob_loc => vBlobIn, amount => vAmount, offset => vOffset)));
    vOffset := vOffset + vAmount;
    END LOOP;
    dbms_lob.freetemporary(lob_loc => vBase64Blob);
    RETURN vBase64Blob;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END encodeBlob2Base64;
    When i now use my function i get the ORA-29261: bad argument in the statement DBMS_LOB.SUBSTR(lob_loc ...)
    Has somebody an idea, what's wrong?
    Many thanks in advance.
    Regards,
    Martin

    The reason is that utl_encode returns a raw whereas dbms_lob.append expects either a blob or a clob.
    SQL> desc utl_encode;
    FUNCTION BASE64_DECODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    FUNCTION BASE64_ENCODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    FUNCTION MIMEHEADER_DECODE RETURNS VARCHAR2
    Argument Name                  Type                    In/Out Default?
    BUF                            VARCHAR2                IN   
    FUNCTION MIMEHEADER_ENCODE RETURNS VARCHAR2
    Argument Name                  Type                    In/Out Default?
    BUF                            VARCHAR2                IN   
    ENCODE_CHARSET                 VARCHAR2                IN     DEFAULT
    ENCODING                       BINARY_INTEGER          IN     DEFAULT
    FUNCTION QUOTED_PRINTABLE_DECODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    FUNCTION QUOTED_PRINTABLE_ENCODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    FUNCTION TEXT_DECODE RETURNS VARCHAR2
    Argument Name                  Type                    In/Out Default?
    BUF                            VARCHAR2                IN   
    ENCODE_CHARSET                 VARCHAR2                IN     DEFAULT
    ENCODING                       BINARY_INTEGER          IN     DEFAULT
    FUNCTION TEXT_ENCODE RETURNS VARCHAR2
    Argument Name                  Type                    In/Out Default?
    BUF                            VARCHAR2                IN   
    ENCODE_CHARSET                 VARCHAR2                IN     DEFAULT
    ENCODING                       BINARY_INTEGER          IN     DEFAULT
    FUNCTION UUDECODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    FUNCTION UUENCODE RETURNS RAW
    Argument Name                  Type                    In/Out Default?
    R                              RAW                     IN   
    TYPE                           BINARY_INTEGER          IN     DEFAULT
    FILENAME                       VARCHAR2                IN     DEFAULT
    PERMISSION                     VARCHAR2                IN     DEFAULT
    SQL> spool off

  • Problem with DBMS_LOB.append() procedure

    Hi all.
    I have a small question about this function:
    I tried to use it to unit 2 CLOB objects. Here is part of my script:
    create or replace
    procedure PAGE_CSV()
    is
    S clob;
    S_FULL clob;
    begin
    DBMS_LOB.append(S_FULL, S);
    end;
    But I've got an error:
    ORA-19011: Character string buffer too small
    May be somebody knows what about his error? I Can not realize why it's about buffer (looks like varchar2), I do not use it...
    Thanks,
    Anton.
    PS Thats for sure, both of objects are not null.
    Edited by: user9050456 on Feb 9, 2010 5:44 AM

    You cannot assign to a lob variable a value larger then 32767 bytes if it doesn't have a persistent storage in the DB.
    SQL> declare
      2  a clob;
      3  begin
      4    a:=lpad('x',4001,'x');
      5    dbms_output.put_line(a);
      6  end;
      7  /
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    PL/SQL procedure successfully completed.
    SQL> declare
      2  a clob;
      3  begin
      4    a:=lpad('x',32768,'x');
      5    dbms_output.put_line(a);
      6  end;
      7  /
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 4You have to do something like this:
    CREATE OR REPLACE PROCEDURE Example_1a IS
        dest_lob BLOB;
        src_lob  BLOB;
    BEGIN
        -- get the LOB locators
        -- note that the FOR UPDATE clause locks the row
        SELECT b_lob INTO dest_lob
            FROM lob_table
            WHERE key_value = 12 FOR UPDATE;
        SELECT b_lob INTO src_lob
            FROM lob_table
            WHERE key_value = 21;
        DBMS_LOB.APPEND(dest_lob, src_lob);
        COMMIT;
    EXCEPTION
        WHEN some_exception
        THEN handle_exception;
    END;Where both the source LOB and the destination one have a persistent storage on db.
    Max
    [My Italian Oracle blog| http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • Error in using DBMS_LOB Package

    Hi,
    I am attaching a PDF File through a database procedure as shown below
    create or replace procedure load_document(document_id in number, filename IN varchar2, doc_desc IN VARCHAR2, doc_type IN VARCHAR2) as
    f_lob bfile;
    b_lob blob;
    --document_name varchar2(30);
    --mime_type varchar2(30);
    document_name oea_documents.document_name%TYPE;
    mime_type oea_documents.document_mime_type%TYPE;
    dot_pos number;
    v_file_type VARCHAR2(10);
    begin
    -- Find the position of the dot ('.') located in the filename
    dot_pos := instr(filename,'.');
    -- Get the filename without extension and use it as image name
    document_name := substr(filename,1,dot_pos-1);
    -- Build the mime type . Retrieve the file extension and add it to 'image/'
    v_file_type := SUBSTR( filename, dot_pos+1, Length(Filename) );
    IF ( UPPER(v_file_type) IN ('JPG','JPEG','TIF','TIFF','GIF') ) THEN
    mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
    ELSIF ( UPPER(v_file_type) = 'PDF' ) THEN
    mime_type := 'application/pdf';
    ELSIF ( UPPER(v_file_type) = 'DOC' )THEN
    mime_type := 'application/msword';
    ELSIF ( UPPER( v_file_type) = 'XLS') THEN
    mime_type := 'application/ms-excel';
    ELSE
    mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
    END IF;
    insert into oea_documents (document_id,
    document_name,
    document_mime_type,
    document,
    document_description,
    document_type
    values(document_id, document_name, mime_type, empty_blob(),doc_desc,doc_type) return document into b_lob;
    -- /!\ Directory name has to be UpperCase !
    f_lob := bfilename('FILE_LOAD',filename);
    o_dset_test('5');
    dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
    o_dset_test('6');
    dbms_lob.loadfromfile(b_lob,f_lob,dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    FILE_LOAD is a folder on the database server(unix).
    I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.
    while executing this procedure I am getting the error ora-22288(Invalid file or directory).
    But this occurs randomly
    For instance i tried to attach a pdf file with the name cross.pdf ,it gave me the above error and when i renamed the file as Cross.pdf it attached successfully.
    The error comes whilke executing the statement dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
    Please guide on the above issue.

    Hi,
    Welcome to the forum!
    user1356624 wrote:
    f_lob := bfilename('FILE_LOAD',filename);
    FILE_LOAD is a folder on the database server(unix).
    I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.The first argument to BFILENAME is the name of a directory object, as found in the directory_name column of all_directories. That is not the same thing as a folder name, which is found in the directory_path column of all_directories. Look up [CREATE DIRECTORY|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_5007.htm#sthref6211] in the SQL Language manual for a description of Oracle's directory objects.
    If you have problems with this, post the results of
    SELECT  *
    FROM    all_directories;It might also be useful to see the Oracle "CREATE DIRECTORY" command that was used.
    As you probably noticed, this site compresses white space by default.
    When you post code or results on this site, type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    Edited by: Frank Kulash on Aug 10, 2009 3:35 PM
    Added link.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problems with moving files to ora directory UTL_FILE.PUT_RAW - ORA-29285

    hi,
    i'm using apex 4.1
    i have a procedure which moves my file from apex_application_files to ORA directory.
    if i choose a text file or small word document which is 1kb, it works. but if i have pdf file (85kb) or word document (16kb) it gives me ORA-29285: file write error
    what's my problem?
    PROCEDURE put_file_to_server (p_filename IN VARCHAR2,p_cert_type IN VARCHAR2,p_cert_pk IN NUMBER)
    AS
    l_file UTL_FILE.file_type;
    l_blob_len INTEGER;
    l_pos INTEGER := 1;
    l_amount BINARY_INTEGER := 32767;
    l_buffer RAW (32767);
    v_new_filename VARCHAR2(100);
    v_bfile BFILE ;
    BEGIN
    -- delete from apex_application_files;
    --Neuen Dateinamen generieren
    v_new_filename := p_cert_type||'_'||p_cert_pk;
    v_bfile := BFILENAME (v_directory, v_new_filename);
    --Datei erstellen
    l_file := UTL_FILE.fopen(v_directory,v_new_filename,'w');
    IF DBMS_LOB.FILEEXISTS (v_bfile) = 1 THEN
    cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'File exists');
    FOR rec IN (select blob_content lblob from apex_application_files where rownum = 1)
    LOOP
    l_blob_len := DBMS_LOB.getlength(rec.lblob);
    cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'Filesize is '||l_blob_len);
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.read (rec.lblob, l_amount, l_pos, l_buffer);
    UTL_FILE.put_raw (l_file, l_buffer, FALSE);
    l_pos := l_pos + l_amount;
    END LOOP;
    COMMIT;
    END LOOP;
    --Datei schließen
    UTL_FILE.fclose(l_file);
    else
    cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'Datei doesn't exist');
    end if;
    EXCEPTION
    WHEN OTHERS
    THEN
    -- Close the file if something goes wrong.
    IF UTL_FILE.is_open (l_file) THEN
    UTL_FILE.fclose (l_file);
    END IF;
    delete from apex_application_files;
    RAISE;
    delete from apex_application_files;
    END put_file_to_server;

    Sorry but din't test this...Can you give it a try and see if this works?
    PROCEDURE put_file_to_server(
        p_filename  IN VARCHAR2,
        p_cert_type IN VARCHAR2,
        p_cert_pk   IN NUMBER)
    AS
      l_file UTL_FILE.file_type;
      l_blob_len INTEGER;
      l_pos      INTEGER      := 1;
      l_amount BINARY_INTEGER := 32767;
      l_buffer RAW (32767);
      v_new_filename VARCHAR2(100);
      v_bfile BFILE ;
      vblob BLOB;
      vstart NUMBER := 1;
      my_vr RAW(32000);
      bytelen NUMBER := 32000;
      LEN     NUMBER;
    BEGIN
      -- delete from apex_application_files;
      --Neuen Dateinamen generieren
      v_new_filename := p_cert_type||'_'||p_cert_pk;
      v_bfile        := BFILENAME (v_directory, v_new_filename);
      --Datei erstellen
      --l_file                          := UTL_FILE.fopen(v_directory,v_new_filename,'w');
      l_file                          := UTL_FILE.fopen(v_directory,v_new_filename, 'WB', 32760);
      IF DBMS_LOB.FILEEXISTS (v_bfile) = 1 THEN
        cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'File exists');
        FOR rec IN
        (SELECT blob_content lblob,
          LENGTH(blob_content) LEN
        FROM apex_application_files
        WHERE rownum = 1
        LOOP
          cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'Filesize is '|| LEN);
          IF LEN < 32760 THEN
            utl_file.put_raw(l_file,lblob);
            utl_file.fflush(l_file);
          ELSE -- write in pieces
            vstart      := 1;
            WHILE vstart < LEN
            LOOP
              dbms_lob.read(vblob,bytelen,vstart,my_vr);
              utl_file.put_raw(l_file,my_vr);
              utl_file.fflush(l_file);
              -- set the start position for the next cut
              vstart := vstart + bytelen;
              -- set the end position if less than 32000 bytes
              x         := x - bytelen;
              IF x       < 32000 THEN
                bytelen := x;
              END IF;
            END LOOP;
          END IF;
         END LOOP;
        ELSE
          cert_log_pkg.m(p_module => 'CERT_FILE_PKG.PUT_FILE_TO_SERVER',p_msg => 'Datei doesnt exist');
        END IF;
        utl_file.fclose(l_file);
      EXCEPTION
      WHEN OTHERS THEN
        -- Close the file if something goes wrong.
        IF UTL_FILE.is_open (l_file) THEN
          UTL_FILE.fclose (l_file);
        END IF;
        DELETE FROM apex_application_files;
        RAISE;
        DELETE FROM apex_application_files;
      END put_file_to_server;Edited by: Vitor Rodrigues on 17/Fev/2012 12:03

  • Download doc problem when copied from APEX_APPLICATION_FILES to local table

    Good morning!
    As the subject indicatesm, I am experiencing problems downloading a document I have copied from APEX_APPLICATION_FILES to my local table FILE_SUBJECTS
    and would be very grateful if someone could help.
    Here is the problem:
    I can successfully upload a document into APEX_APPLICATION_FILES and dowload it from there too.
    I can copy the record from APEX_APPLICATION_FILES into my local table FILE_SUBJECTS and delete that entry from APEX_APPLICATION_FILES but I cannot download it from my local table, it keeps pointing me to a page which cannot be found, so I'm guessing there is something wrong with either, my INSERT INTO statement or, my link in the report.
    My INSERT INTO statement is:
    INSERT INTO file_subjects (id,filename,updated_by,updated_on,blob_content,mime_type)
    SELECT id, filename, name, updated_by, updated_on,blob_content,mime_type
    FROM APEX_APPLICATION_FILES
    WHERE APEX_APPLICATION_FILES.filename = :P2_FILE_NAME;
    REPORT LINK
    I have tried just a normal column link in my report like: #ID# (this works when looking at APEX_APPLICATION_FILES)
    but I have also tried the following:
    #OWNER#.DOWNLOAD_MY_FILE?p_file=#ID#
    where download_my_file is a procedure:
    create or replace PROCEDURE "DOWNLOAD_MY_FILE" (p_file in number) AS
    v_mime VARCHAR2(48);
    v_length NUMBER;
    v_file_name VARCHAR2(2000);
    Lob_loc BLOB;
    BEGIN
    --apex_application.g_flow_id := 166;
    --if not(APEX_CUSTOM_AUTH.IS_SESSION_VALID) then
    -- owa_util.status_line(404, 'Page Not Found', true);
    -- return;
    --end if;
    SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
    INTO v_mime,lob_loc,v_file_name,v_length
    FROM FILE_SUBJECTS
    WHERE id = p_file;
    -- set up HTTP header
    -- use an NVL around the mime type and
    -- if it is a null set it to application/octect
    -- application/octect may launch a download window from windows
    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    end DOWNLOAD_MY_FILE;
    Many thanks in advance!
    Sue

    Sue,
    If you are running XE or running with the EPG versus the http server, you need to grant access to the procedure you are using for it to be run properly..
    You may need to look at this function, if you are using XE or have the EPG setup for your database.. http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e12856/adm_wrkspc.htm#BABEFDHI [Look for the section called *Restricting Access to Oracle Application Express by Database Access Descriptor (DAD)*]
    Thank you,
    Tony Miller
    Webster, TX

  • Problem upgrading Apex 2.1 to 3.2.1 in Oracle Database 10g Express Edition

    G'Day Apex gurus,
    I installed Oracle Database 10g Express edition in my Windows XP PC which comes with Apex 2.1 with no problems. Then I wanted to upgrade Apex 2.1 to 3.2.1 (Currently Apex download in OTN) following the document below:
    http://www.oracle.com/technology/products/database/application_express/html/3.1_and_xe.html
    I went to the steps:
    @apexins SYSAUX SYSAUX TEMP /i/
    Then to change the password for the admin account run apxchpwd.sql and when prompted enter a password for the ADMIN account.
    @apxchpwd
    with not problems
    Then I connected to SQL*Plus as SYS by:
    sqlplus /nolog
    CONNECT SYS as SYSDBA
    Enter password: xxxxxxxxxxx
    but when I tried to run:
    @APEX_HOME/apex/apxldimg.sql APEX_HOME
    where APEX_HOME is Apex3.2.1 in my case
    SQL> @Apex3.2.1/apex/apxldimg.sql Apex3.2.1 (I get the messages below)
    PL/SQL procedure successfully completed.
    old   1: create directory APEX_IMAGES as '&1/apex/images'
    new   1: create directory APEX_IMAGES as 'Apex3.2.1/apex/images'
    Directory created.
    declare
    *+
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    The system cannot find the path specified.
    ORA-06512: at "SYS.DBMS_LOB", line 523
    ORA-06512: at "SYS.XMLTYPE", line 287
    ORA-06512: at line 15
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    Commit complete.
    timing for: Load Images
    Elapsed: 00:00:00.17
    Directory dropped.
    Can anyone help me in how to trouble shout this?
    I tried to continue by following the steps document
    @APEX_HOME/apex/apxxepwd.sql password
    (where password is the password of the Application Express internal ADMIN account)
    but when I tried to login in:
    http://localhost:8080/apex/f?p=4550:1
    when I type the credentials
    system
    system
    systempassword
    nothing happens
    or even If I try:
    http://localhost:8080/apex/f?p=4550:10
    admin
    adminpassword
    nothing happens here too.
    I appreciate any help
    Kind regards
    Carlos

    My database version is 10.2.0.1.0 Oracle express.
    Operating system is Windows Vista.
    I started installing using the following commands.
    @ C:\temp\apex\apexins.sql
    it prompts me for the values of sysaux sysaux temp and c:\temp\apex\images\
    If I supply the value for images the sqlplus window closes after scrolling a lot of info.
    Enroute it also prompts me for a value for 9:
    I don't know what the input shall be.
    Then it again stops at enter value for version:
    I used 3.2.1.0
    The window scrols a while and closes.
    later I changed the password and ran the command.
    @c:\temp\apex\apxldimg.sql c:\temp
    but no success with installation.
    the output is as following.
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 27 18:13:43 2009
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> connect system/sairam as sysdba;
    Connected.
    SQL> @ c:\temp\apex\apxchpwd
    Enter a value below for the password for the Application Express ADMIN user.
    Enter a password for the ADMIN user []
    Session altered.
    ...changing password for ADMIN
    wwv_flow_security.g_security_group_id := 10;
    ERROR at line 3:
    ORA-06550: line 3, column 5:
    PLS-00201: identifier 'WWV_FLOW_SECURITY.G_SECURITY_GROUP_ID' must be declared
    ORA-06550: line 3, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 4, column 5:
    PLS-00201: identifier 'WWV_FLOW_SECURITY.G_USER' must be declared
    ORA-06550: line 4, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 5, column 5:
    PLS-00201: identifier 'WWV_FLOW_SECURITY.G_IMPORT_IN_PROGRESS' must be declared
    ORA-06550: line 5, column 5:
    PL/SQL: Statement ignored
    ORA-06550: line 8, column 23:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 7, column 15:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 13, column 32:
    PLS-00364: loop index variable 'C1' use is invalid
    ORA-06550: line 12, column 9:
    PL/SQL: Statement ignored
    ORA-06550: line 19, column 5:
    PLS-00201: identifier 'WWV_FLOW_SECURITY.G_IMPORT_IN_PROGRESS' must be declared
    ORA-06550: line 19, column 5:
    PL/SQL: Statement ignored
    Commit complete.
    SQL> @c:\temp\apex\apxldimg.sql c:\temp
    PL/SQL procedure successfully completed.
    Directory created.
    if wwv_flow_utilities.db_version_is_at_least('11') then
    ERROR at line 32:
    ORA-06550: line 32, column 25:
    PLS-00302: component 'DB_VERSION_IS_AT_LEAST' must be declared
    ORA-06550: line 32, column 3:
    PL/SQL: Statement ignored
    PL/SQL procedure successfully completed.
    if wwv_flow_utilities.db_version_is_at_least('11') then --11g only
    ERROR at line 16:
    ORA-06550: line 16, column 25:
    PLS-00302: component 'DB_VERSION_IS_AT_LEAST' must be declared
    ORA-06550: line 16, column 3:
    PL/SQL: Statement ignored
    Commit complete.
    timing for: Load Images
    Elapsed: 00:00:00.32
    Directory dropped.
    SQL>
    Does this require XE 11 or anything else.
    This will happen even if I supply as following(closing of sqlplus in the begining).
    @ C:\temp\apex\apexins.sql sysaux sysaux temp c:\temp\apex\images\
    Any help.

  • Problem calling XML Report Publisher from Oracle Reports

    Hi,
    I'm facing a problem in calling XML Report Publisher from Oracle Reports.
    Basically, I'm trying to customise Dunning Letter program. The program which is submitted calls another program. I have customised the second program and added a call to a stored procedure which in turn calls XML Report Publisher.I have created a template and attached it to the second program as well.
    The procedure code is as follows.
    v_request_id := FND_REQUEST.SUBMIT_REQUEST(application => 'AR'
    ,program => 'ARDLP_NON_SRS'
    ,description => 'Dunning Letter Print from Dunning Letter Generate'
    ,sub_request => FALSE
    l_status := fnd_concurrent.WAIT_FOR_REQUEST
    ( REQUEST_ID => v_request_id,
    INTERVAL => 15,
    MAX_WAIT => 180,
    PHASE => l_phase,
    STATUS => l_status_code,
    DEV_PHASE => l_dev_phase,
    DEV_STATUS => l_dev_status,
    MESSAGE => l_message );
    v_xml_req_id := FND_REQUEST.submit_request(application => 'XDO',
    program => 'XDOREPPB',
              argument1 => v_request_id,
    argument2 => 'FLS DE AR Dunning Letter Print - German',
    argument3 => 603, -- changed 665 -- was 551,
    argument4     => NULL,
    argument5 => 'N',
    argument6     => 'RTF',
              argument7     => 'PDF');
    Now, there are two problems I'm facing...
    1. when the second program('Dunning Letter Print from Dunning Letter Generate') gets called it executes this procedure ... logically the 'Dunning Letter Print from Dunning Letter Generate' should get called twice ... second time from the procedure. Its getting called multiple times .. as many as 15 - 20 times.
    2. The Xml Report Publisher program ultimately gets called but its erroring out with the following error:
    java.sql.SQLException: No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA, DBMS_LOB.GETLENGTH(L.FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_CODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.DS_APP_SHORT_NAME DS_APP_SHORT_NAME, B.DATA_SOURCE_CODE DATA_SOURCE_CODE, L.LOB_TYPE LOB_TYPE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE (L.LOB_TYPE = 'TEMPLATE' OR L.LOB_TYPE = 'MLS_TEMPLATE') AND L.APPLICATION_SHORT_NAME= :1 AND L.LOB_CODE = :2 AND L.APPLICATION_SHORT_NAME = B.APPLICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND ( (L.LANGUAGE = :3 AND L.TERRITORY = :4 ) OR (L.LANGUAGE = :5 AND L.TERRITORY = :6) OR (L.LANGUAGE= B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ) )
    I have checked from database that the XDO_LOBS/ XDO_TEMPLATES_B table has corresponding registration data.
    I don't know what's creating the problem.
    If anyone has customised the Dunning Letter program before or having any idea about this problem, please help me out ..
    Thanks

    satrajit,
    Now I am getting the same error you got, Can you please tell me the solution you found?.
    XML Report Publisher 5.0
    Updating request description
    Waiting for XML request
    Retrieving XML request information
    Preparing parameters
    Process template
    --XDOException
    java.sql.SQLException: No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA, DBMS_LOB.GETLENGTH(L.FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGUAGE DEFAULT_LANGUAGE, B.DEFAULT_TERRITORY DEFAULT_TERRITORY,B.TEMPLATE_TYPE_CODE TEMPLATE_TYPE_CODE, B.USE_ALIAS_TABLE USE_ALIAS_TABLE, B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STATUS TEMPLATE_STATUS, B.USE_ALIAS_TABLE USE_ALIAS_TABLE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE L.LOB_TYPE = :1 AND L.APPLICATION_SHORT_NAME= :2 AND L.LOB_CODE = :3 AND L.APPLICATION_SHORT_NAME = B.APPLICATION_SHORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND ( (L.LANGUAGE = :4 AND L.TERRITORY = :5 ) OR (L.LANGUAGE = :6 AND L.TERRITORY = :7) OR (L.LANGUAGE= B.DEFAULT_LANGUAGE AND L.TERRITORY= B.DEFAULT_TERRITORY ) )
         at oracle.apps.xdo.oa.schema.server.TemplateInputStream.initStream(TemplateInputStream.java:309)
         at oracle.apps.xdo.oa.schema.server.TemplateInputStream.<init>(TemplateInputStream.java:187)
         at oracle.apps.xdo.oa.schema.server.TemplateHelper.getTemplateFile(TemplateHelper.java:776)
         at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:1269)
         at oracle.apps.xdo.oa.cp.JCP4XMLPublisher.runProgram(JCP4XMLPublisher.java:807)
         at oracle.apps.fnd.cp.request.Run.main(Run.java:148)

  • Problem  to display multiple images in report!

    Hi,
    I have 3 tables, in each table i have a column with an image "blob"!
    I have creat a view with this 3 tables and a report of this view.
    My problem is that when i try to show one image column in report, "there is no problem", but when i try to show two or tree column´s with images, it display's only the last image that i call in report!
    select     "V_VIEW"."ID_STATE" as "ID_STATE",
         "V_VIEW"."STATE" as "STATE",
         "V_VIEW"."ID_TABLE" as "ID_TABLE",
         "V_VIEW"."NAME" as "NAME",
         "V_VIEW"."ID_PRIORI" as "ID_PRIORI",
         "V_VIEW"."PRIORI" as "PRIORI",
         "V_VIEW"."ID_PRODUCT" as "ID_PRODUCT",
         "V_VIEW"."PRODUCT" as "PRODUCT" ,
    dbms_lob.getlength("V_VIEW"."IMAGE") IMAGEPRODUCT,
    dbms_lob.getlength("V_VIEW"."IMAGEPRIORI") IMAGEPRIORI,
    dbms_lob.getlength("V_VIEW"."IMAGESTATE") IMAGESTATE
    from     "V_VIEW" "V_VIEW"
    Using normal standart report with in report atributes column:
    IMAGE:T_STATES:IMAGESTATE:ID_STATE::::::inline:
    What are i making wrong, in this case he does only make the last dbms_lob.getlength and shows only dbms_lob.getlength(IMAGESTATE) IMAGESTATE;
    If i change the order of the report and put in the end of the code:
    dbms_lob.getlength(IMAGETYPE) IMAGETYPE, the he shows this last image!
    I have try to make a demonstration of my problem on this forum, so i have creat an example on apex.oracle.com and there it works just fine, showing all the images of report.
    i am using apex 3.1.0.00.32
    Why doesn't the same example work in my aplication.
    If someone can have a look at working example:
    http://apex.oracle.com/pls/otn/f?p=53120:1:1299118515377853:::::
    pepe
    pepe
    pepe25
    Thank's in advance;
    Pepe

    Pepe,
    Is the first report on the page working correctly? I think so. So I don't see an example of what you described.
    I do see that there are no images in the second report, but that's not the same as the first problem you described, is it?
    Scott

  • Problem in using CLOB Data from a Data and exporting into File

    Hi,
    UTL_FILE Error Occured while using UTL_FILE with CLOB Data.
    UTL_FILE: A write error occurred.
    The Below Code is for reference:
    DECLARE
    C_AMOUNT CONSTANT BINARY_INTEGER := 32767;
    L_BUFFER VARCHAR2(32767);
    L_CHR10 PLS_INTEGER;
    L_CLOBLEN PLS_INTEGER;
    L_FHANDLER UTL_FILE.FILE_TYPE;
    L_POS PLS_INTEGER := 1;
    BEGIN
         FILE_NAME:=UTL_FILE.FOPEN('EXPORT_DIR','EXPORT_FILE'||'.sql','W');
         FOR C1_EXP IN (SELECT INSERT_STRING FROM EXPORTED_DUMP) LOOP
         L_CLOBLEN := DBMS_LOB.GETLENGTH(C1_EXP.INSERT_STRING);
         DBMS_OUTPUT.PUT_LINE('THE CLOB LEN '||L_CLOBLEN);
         DBMS_OUTPUT.PUT_LINE('THE POSITION '||L_POS);
         WHILE L_POS < L_CLOBLEN LOOP
    L_BUFFER := DBMS_LOB.SUBSTR(C1_EXP.INSERT_STRING, C_AMOUNT, L_POS);
         DBMS_OUTPUT.PUT_LINE('THE BUFFER IS '||L_BUFFER);
    EXIT WHEN L_BUFFER IS NULL;
    UTL_FILE.PUT_LINE(FILE_NAME, C1_EXP.INSERT_STRING);
    L_POS := L_POS + LEAST(LENGTH(L_BUFFER)+1,c_amount);
    END LOOP;
         END LOOP;
    UTL_FILE.FCLOSE(FILE_NAME);
    EXCEPTION
    WHEN UTL_FILE.INTERNAL_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An internal error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: The file handle was invalid.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_MODE THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid open mode was given.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_OPERATION THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid operation was attempted.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.INVALID_PATH THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: An invalid path was give for the file.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.READ_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A read error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN UTL_FILE.WRITE_ERROR THEN
    DBMS_OUTPUT.PUT_LINE ('UTL_FILE: A write error occurred.');
    UTL_FILE.FCLOSE_ALL;
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE ('Some other error occurred.');
    UTL_FILE.FCLOSE_ALL;
    END;

    Hi user598986!
    OK, I understood that there is a problem with your code. But please would you be so kindly to tell us here what error exactly happens (the errormessage). Mabay after that someone will be able to help you.
    yours sincerely
    Florian W.
    P.S. If you enclose your code into tags it will be shown formated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Gui_upload for uploading binary file

    Hello All, I am trying to upload '.jpg' files using gui_upload function. But something goes wrong and it dumps. I am new to ABAP. following is the code i used.   DATA: xline TYPE xstring.   DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.   CALL F

  • Problem with cflogin

    I am using cflogin for processing login page and use session variable to store info, but I have a problem that when I login to admin page (www.mysite.com/admin/index.cfm) It has no problem but when I return to my homepage (www.mysite.com/index.cfm ty

  • Bought "Artist Lesson" not showing up anywhere

    I bought a lesson, transaction went through, says it was electronically delivered but its not showing up anywhere under "learn to play" or anywhere else. it hasn't downloaded, and I have no idea how to get it or where it is. I bought a lesson for pia

  • Download servlet from external server

    I write a download file servlet. It should download files from external ftp and make the save as dialog window save it with proper extension. It gets 3 parametes: http://10.60.1.1:8080/sd-sp45/DownloadServlet?fileName=55555.doc&filePath=000/000/000/0

  • Need help on content protection

    i can't connect to blackberry apps world because it keep saying that i need to turn off my content protection, and don't know how to do so. can anyone help please??