Forum Stats

  • 3,838,776 Users
  • 2,262,398 Discussions
  • 7,900,755 Comments

Discussions

Read blob file from oracle apex wwv_flow_files

3705168
3705168 Member Posts: 3
edited Jun 1, 2018 8:05AM in APEX Discussions

I uploaded excel file with special characters. When I am reading the blob file from apex wwv_flow_files.Special characters are ignored.I tried with below code.

DECLARE     v_blob       BLOB;  v_start      NUMBER         := 1;  v_bytelen    NUMBER         := 2000;  v_len        NUMBER;  v_raw        RAW (2000);  v_x          NUMBER;  v_sql_text    VARCHAR2(32767):= NULL;  v_data_array        wwv_flow_global.vc_arr2;  v_sr_no             number:= 1; BEGIN     SELECT DBMS_LOB.getlength (blob_content)       INTO v_len      from wwv_flow_files where NAME='F1364968530/TEST_EXCEL.CSV';      -- save blob length      v_x := v_len;      -- select blob into variable      SELECT blob_content       INTO v_blob      from wwv_flow_fileswhere NAME='F1364968530/TEST_EXCEL.CSV';     v_start := 1;     WHILE v_start < v_len AND v_bytelen > 0     LOOP        DBMS_LOB.READ (v_blob, v_bytelen, v_start, v_raw);        v_sql_text := UTL_RAW.cast_to_varchar2 (v_raw);         -- set the start position for the next cut         v_start := v_start + v_bytelen;         -- set the end position if less than 2000 bytes         v_x := v_x - v_bytelen; htp.prn(v_sql_text);     END LOOP;     END;

How to Read the special characters from blob.

Tagged:

Answers

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,101 Red Diamond
    edited Jun 1, 2018 8:05AM
    51a40bb7-1a27-4107-8fa7-298b198c3851 wrote:

    Update your forum profile with a recognisable username instead of "51a40bb7-1a27-4107-8fa7-298b198c3851": Video tutorial how to change nickname available

    Help us to help you. Always follow these guidelines when posting a question: how to get answers from forum

    I uploaded excel file with special characters. When I am reading the blob file from apex wwv_flow_files.Special characters are ignored.I tried with below code.How to Read the special characters from blob.

    What are "special characters"? In a Unicode world I find little reason to consider any characters (other than ANSI control codes) any more or less "special" than others.

    What problem are you really trying to solve?

  • Mike Kutz
    Mike Kutz Member Posts: 6,195 Silver Crown
    edited May 9, 2018 11:21AM

    CSV is TEXT

    CSV is NOT Excel.

    WWV_FLOW_FILES is deprecated as of 5.0

    CSV is NOT Excel.

    DBMS_LOB has a "ConvertToCLOB" procedure.  You should be using that procedure.

    CSV is NOT Excel.

    You've hardcoded the filename.  You will never get the file the 2nd time you try. (the directory is suppose to change for security reasons)

    CSV is NOT Excel.

    CSV is Text.  Excel is [propriatary] Binary format.

    CSV is NOT Excel.

    In order to read "special characters" from a TEXT file (like a CSV file), your file needs to be in UTF-8 format.

    In order to properly read "special characters" from a TEXT file (like a CSV file), your database needs to support those characters (eg UTF-8).  You can't read Arabic, Chinese, Russian characters from a Text file if your database is using US English character set (eg WE8ISO8859P15 will cause you to fail.)

    MK

This discussion has been closed.