.csv file BLOB conversion

Hi all


I have two files (a .txt and a .csv). I have to send these two files through PL/SQL after their conversion to BLOB.

How to convert .txt and .csv in BLOB files?

Please help me in this regard.
Thank you!


--
REDA

889224 wrote:

The requirement came as BLOB supports up to 4 GB if I'm not mistaken. So for this I have to convert it to BLOB.

BLOB or CLOB are LOB data types. Oracle supports up to 128 PB type LOB data.

Anyway is to be converted to BLOB?

Convert what exactly? What is the source?

If the source is an external file on the Oracle server, and then DBMS_LOB. LoadFromFile() can be used.

If the source is an external file on the platform of the Oracle customer, then the customer must read the source file and use for example DBMS_LOB. WriteAppend() to add the source file for the LOB.

If the client is a web browser, download of standard files can be used and the downloaded file will be in your table of documents mod_plsql .

If the source is a web service, for example providing the file, UTL_HTTP can be used to read the output of the web service and the Chuck in a LOB.

Etc.

So it must be very clear on what exactly is the problem.

Tags: Database

Similar Questions

  • Conversion of hundreds of data in CSV files. Script on command prompt?

    Hi, so I think I have a unique problem with an easy solution. I have more than 1400 files which are actually (roughly acsii) RAW data files that I need to parse CSV files converted. They are all in the same folder, and I know there are scripts there to take all the files in the folder and the list of people in the CSV format. I just want to convert all the files in the CSV file. I could use Excel and manually convert all 1400 of them, but there must be a better way. Also, it would be great if everything was annexed to 1 VERY large CSV file.

    I'm relatively new to the windows command prompt window, so any help would be greatly appreciated.

    Thank you!!

    Check this: copy command to allow adding files: https://www.youtube.com/watch?v=MX2SXdR9yfw

    You can use it to combine all the files, then open them only once, and convert the whole thing to a CSV file in a single step.

  • Conversion of out-line of output to a. CSV file

    Hi all

    I was wondering if it would be possible to convert the output of the out-file cmdlet to a .csv file.  When I use out-file it creates a text file that puts each item on its own line.

    For example, the text file would be:

    Server2

    Server3

    Server4

    I would like to convert this .txt file to a .csv file, which would be:

    Server2, Server 3, Server 4, etc.

    I tried to use the Export-csv cmdlet instead of the out-file cmdlet, but I can't seem to make it work, so instead I was wondering if it would be possible to convert the text using a pre-made PowerCLI command or some type of line of the script to remove and replace characters and delimiters.

    Thank you very much for any help or assistance that anyone can give.

    Best

    Oops, my mistake.

    See if it works for you

    (Get-Content 'C:\text.txt' | %{"'$_'"}) - join ',' |) Out-file "C:\csv.csv."

  • Import CSV file and the conversion of an array

    Hi all

    I'm working on a site that is to import a CSV (comma separated values) published via actionscript 3.0 URLloader().  Now I just try to get actionscript to successfully enter the data imported from the CSV file as a table, then the CSV file has 1 single cell that contains "athleticMaroon, charcoal, colonialBlue, kellyGreen, fullColor".

    Here is the code I use:

    create table

    var shirtLiveIntense_btn_Colors:Array = new Array();

    run the import from CSV data

    URLLoaderCSV();

    shirtLiveIntense_btn.addEventListener (MouseEvent.CLICK, selectingLogo);

    function selectingLogo(e:MouseEvent):void {}

    trace ("current logo');

    var colorButtons:Array = this [e.currentTarget.name + "_Colors"];

    for (var i: uint = 0; i < colorButtons.length; i ++) {}

    .Ivar colorButtons [i] = i;

    colorButtons [i] .addEventListener (MouseEvent.CLICK, shirtColorOption);

    }

    }

    CSV data import function

    function URLLoaderCSV() {}

    var loader: URLLoader = new URLLoader();

    configureListeners (loader);

    var request: URLRequest = new URLRequest ("https://docs.google.com/spreadsheet/pub?hl=en_US & hl = en_US & key = 0AlJnOKOffTSxdFk0RVlEUTVHeF9 DMHZfZ0JzSkJjZFE & single = true & gid = 1 & output = csv");

    try {}

    Loader.Load (request);

    } catch (error: Error) {}

    trace ("unable to load requested document.");

    }

    }

    function configureListeners(dispatcher:IEventDispatcher):void {}

    dispatcher.addEventListener (Event.COMPLETE, completeHandler);

    dispatcher.addEventListener (Event.OPEN, openHandler);

    dispatcher.addEventListener (ProgressEvent.PROGRESS, progressHandler);

    dispatcher.addEventListener (SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);

    dispatcher.addEventListener (HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

    dispatcher.addEventListener (IOErrorEvent.IO_ERROR, ioErrorHandler);

    }

    function completeHandler(event:Event):void {}

    var loader: URLLoader = URLLoader (event.target);

    trace ("completeHandler:" + loader.data);

    shirtLiveIntense_btn_Colors.push (loader.data);

    }

    function openHandler(event:Event):void {}

    trace ("openHandler:" + event);

    }

    function progressHandler(event:ProgressEvent):void {}

    trace ("progressHandler loaded:" + event.bytesLoaded + "total:" + event.bytesTotal);

    }

    function securityErrorHandler(event:SecurityErrorEvent):void {}

    trace ("securityErrorHandler:" + event);

    }

    function httpStatusHandler(event:HTTPStatusEvent):void {}

    trace ("httpStatusHandler:" + event);

    }

    function ioErrorHandler(event:IOErrorEvent):void {}

    trace ("ioErrorHandler:" + event);

    }

    Here is the result:

    openHandler: [event type = "open" bubbles = false cancelable = false eventPhase = 2]

    progressHandler loaded: 57 total: 0

    httpStatusHandler: [HTTPStatusEvent type = "httpStatus" bubbles = false cancelable = false eventPhase = 2 status = 200]

    completeHandler: athleticMaroon, colonialBlue, kellyGreen, charcoal, fullColor

    chosen logo

    ReferenceError: Error #1056: cannot create ivar String property.

    at main_fla::MainTimeline/selectingLogo()

    Review of results of release, I see it's clearly to load the data from the CSV file correctly, but what I think it does is important data as a single string, aka 'athleticMaroon, charcoal, colonialBlue, kellyGreen, fullColor' and push for shirtLiveIntense_btn_Colors:Array = new Array().  But, as I see the error selectingLogo(e:MouseEvent) service cannot treat the table because it contains a string of.

    If I switch to shirtLiveIntense_btn_Colors.push (loader.data); with shirtLiveIntense_btn_Colors.push (charcoal, colonialBlue, kellyGreen, athleticMaroon, fullColor); everything works like a charm, but I need the table to assign dynamic in the CSV file data

    Can anyone help to get imported CSV data to strings pushed a table accessible?

    Thank you!


    It is an error caused by:

    var colorButtons:Array = this [e.currentTarget.name + "_Colors"];

    for (var i: uint = 0; i

    .Ivar colorButtons [i] = i;

    colorButtons [i] .addEventListener (MouseEvent.CLICK, shirtColorOption);

    }

    your table is an array of strings.  If you try to force these strings into objects on the timeline that contains your code, use array notation:

    var colorButtons:Array = this [e.currentTarget.name + "_Colors"];

    for (var i: uint = 0; i

    This .ivar [colorButtons [i]] = i;

    This [colorButtons [i]] .addEventListener (MouseEvent.CLICK, shirtColorOption);

    }

  • cannot paste copied from CSV files online entered into the Excel worksheet (chatted with Cedric_L on 03/05/10 at approximately 2.30 CST but I got disconnected. not got an answer...)

    Here is the transcript of a chat with Firefox community member zzxcon may 3/10

    Now you are chatting with Firefox community member Cedric_L
    Cedric_L: Hello
    Cedric_L: what happens when you try to download a .csv file?
    Seegal: Hello
    Seegal: it is not copy
    Cedric_L: how you try to copy?
    Seegal: pls bear with me, I'm a slow typist. Just copy the selected text
    Biolizard joined the conversation.
    Cedric_L: ok - you choose what text?
    Seegal: I reconcile my checkbook (worksheet in this way). I copy my bank acc online items and paste it in the worksheet
    Seegal: I use Firefox 2.0.0.19. Have no problem to do so.
    Cedric_L: what version of Mac OS X?
    Seegal: in the new version nothing happens when trying to paste - just doesn't add up
    Cedric_L: Firefox 2.0.0.x is no longer supported and has not been supported by more than a year
    Cedric_L: paste into Excel from Firefox?
    Seegal: Sorry, I'm early... 2.0.0.19
    Seegal: Yes. I opened my bank acc in Firefox
    Cedric_L: what version of Excel?
    Cedric_L: it would really help if you could tell me step by step what you do.
    Seegal: first re: your previous question: is OS 10.4.11
    Seegal: on Excell: it' ACE 2004 version - the lasat one product for Macs. The specific version is 11.3.7
    Seegal: so I opened my ACC. to bank online in Firfox (my main browser). I copy the last entry in the account and paste in my Excel spreadsheet.
    Cedric_L: so, you copy directly from the web page without having to download a CSV file?
    Seegal: what do you mean by CSV file download? I could export to the https://chat-support.mozilla.com:9091/webchat/getimage? image = sendmessage & workgroup=support%40workgroup.chat-support.mozilla.comFirefox to the CSV file, but the other way around?
    Cedric_L: you copy your bank statement directly from the web site to Excel by using the Clipboard?
    Seegal: so do not use the Clipboard. It is a mac. There is no need to do so. In the PC, it would be Yes.
    Cedric_L: I need to know the exact steps that you deliver to bring in excel
    Cedric_L: and I need to know what exactly goes wrong in the latest version of Firefox.
    Seegal: you have a mac it with Firefox and Excel? It is very easy to reproduce. Imagine you open access to online banking, select a few entries, click on 'copy', to make your already open Excel worksheet and click "Paste". That's all!
    Cedric_L: when this happens, do you have cryptic code pasted into Excel?
    Seegal: as I said before: in all newer versions starting with 3.0 when I go to Excel to 'stick' of my bank acc, nothing happens. It does not stick. No, I don't get a cryptic code pasted, just NOTHING.

    Cedric_L: what happens if you paste into MS Word instead?
    Seegal: haven't tried, most likely the formatting would be lost. Tried with an another el Exc spreadsheet-it lost all the formatting and pasted as continuous text.

    This has happened

    Each time Firefox opened

    Is copy of the cat above. THIS MAC OS X. In the older versions before 3.0 I could copy the CSV file on the site Web Ibank VAC) and paste it directly to my spreadheet Excel reconciling my account.

    There is a known issue with Mac Office versions prior to 2007 version that results in release of Clipboard does not correctly supported. Firefox 3.0, being a more recent application, using the new format for the HTML Clipboard data. Unfortunately, Office 2004 and Office X do not support this.

    If you upgrade to MS Office 2007, it should work as expected.

  • How to create a header in csv file

    I m still beginner in Labview, I'm just learning it this week...

    I want to do a data conversion for temperature probe...

    I m having trouble creating a header in the csv file, can anyone help me?

    I am also attaching my csv file, what I wanted to do like this:

    DT (ms) channel 0 channel 1 Channel 2
    0.1 1 2 3
    0.2 4 5 6
    0.3 7 8 9
    0.4 10 11 12

    I also want to know how to make time to count 0 not real time...

    Citras wrote:

    I have to solve the problem, it s quite confusing, I have to use; instead of \t in the separator.

    What is so confusing to this topic?  You have chosen to use the semicolon, so you must explicitly specify the VI to use instead of the default of a tab.

    When I start the program, can I do the dt (ms) count of 0? What I can do is to use the Date/Time Format string, I want Don t the time based on real time count

    You can subtract the current time of the time at the beginning of the program. Use the time to get based on seconds outside of the loop let you time initially and then use it inside to get the current time. Subtract. Note that your loop is clocked by the software, so you won't get the same amount of delta.

    Also: do not hard code paths in the code. What do you think will happen if someone tried to run your VI on a XP machine? This will not work because of the path of the file. Use a control with a default value defined for it.

  • LabVIEW csv file reading does not correctly.

    I try to use the spreadsheet read vi file as follows the attached csv.

    He did some things wrong:

    (1) the first cell in the resulting table has ÿþ attached to the front of it, it looks like labview is striking some special characters, it should not? (Notepad, notepad ++ and excel can open all the file with no problem and no show ÿþ or something like that).

    (2) it is abuse characters from end of LIFE as two line breaks, resulting in empty rows between each row of data. (Looking at the csv file in notepad ++ confirms that the lines are completed with a CR and LF (same as EOL).)

    (3) I read in sub form of string, because one of the columns is nonnumeric, but then I remove this column of and try to convert the remaining string table in a digital picture (failure). It also fails if I shoot an individual element of the array and try to convert it to a number (in either case, using the string fract/exp number), below, I have an example of attempted to read from the 2nd column of the 1st row (index: 0.1) which is being shaped as a string: "1.37238168716431" and conversion which gives 0 as you can see in the snapshot of the façade into a number.


  • list box given to the .csv file using write on the worksheet File.vi

    Hi, I use the write on the worksheet File.vi to write data multicolumn ListBox to the .csv file. If I do record from Excel, the pop-up window shows as an attachment. And data listbox are too different.  I want the data displayed in the first line not the second row (third photo).

    Thank you for your help.

    Before making your Save As in Excel, change the cell formatting of number. This should avoid the scientific notation conversion before you re-register.

    Or just use Notepad to display the file instead of Excel.

  • How to *. ZIP has *. CSV file in the Oracle Directory?

    Hello! How are you doing guys?

    I have a question;

    How to Zip, a CSV file in the oracle directory?

    I use this method, but a mistake;

    Error; Invalid file operation, this line: utl_file.get_raw (v_arquivo_out, strbufferdd);

    ___The Script___

    v_arquivo_out: = utl_file.fopen ('ORA_DIR',-/ oracle/files/ORA/ORADIR /)

    "DOC. CSV', - file name

    "WORLD BANK");

    UTL_FILE.get_raw (v_arquivo_out, strbufferdd);  <-this line a mistake.

    strbufferdd: = UTL_COMPRESS.lz_compress (strbufferdd, 6);

    V_SDIRECTORY: = TO_CHAR (SYSDATE, ' DD_MM_YYYY_HH24.MI.) SS') | "_RETORNA. ZIP';

    psDsc_File: = v_sDirectory;

    v_arquivo_out2: = utl_file.fopen ('ORA_DIR',-/ oracle/files/ORA/ORADIR /)

    psDsc_File,

    'W');

    -as_zip.

    Utl_File.Put_Raw (v_arquivo_out2, strbufferdd);

    UTL_FILE.fclose (v_arquivo_out);

    UTL_FILE.fclose (v_arquivo_out2);

    ___End SCRIPT___

    Help me?

    Thank you to all the world, I have the solution;

    Please see the procedure;

    CREATE OR REPLACE PROCEDURE 'PR_RELAT_CSV '.

    (

    peCod_Prog in DOCUMENT. Type of Cod_Prog %,

    psDsc_File out varchar2

    )

    IS

    -variaveis para land

    v_arquivo_out utl_file.file_type;

    v_separator varchar2 (1): = "";

    v_sDirectory varchar2 (200);

    src_file BFILE.

    v_content BLOB;

    v_blob_len INTEGER.

    v_file UTL_FILE.file_type;

    v_buffer RAW (32767).

    v_amount directory: = 32767;

    v_pos INTEGER: = 1;

    BEGIN

    -DADOS PREENCHIDOS. ABAIXO, CRIAR PREENCHER E O LAND CSV

    V_SDIRECTORY: = TO_CHAR (SYSDATE, ' DD_MM_YYYY_HH24.MI.) SS') |

    ' _RETORNA. CSV';

    psDsc_File: = v_sDirectory;

    v_arquivo_out: = utl_file.fopen ('ORA_DIR',-/ oracle/files/oradir/ora /)

    psDsc_File,

    'W');

    cabecalho - write

    UTL_FILE.put_line (v_arquivo_out,

    "Organize" | v_separator | ' OPTIONS / Options'.

    v_separator | "AP" | v_separator | "CODE" |

    v_separator | 'Description of the PN | v_separator |

    "Station". v_separator | "Initial SN | v_separator |

    "Final SN | v_separator | 'Note ' | v_separator |

    'Pos ' | v_separator,

    (FALSE);

    -write linhas

    / * n : = 0 ; Contador * /.

    for rec_ (SELECT DISTINCT a.*, d.DSC_ITEM, e.COD_PN_MAT

    OF pcm_subestacao one

    LEFT JOIN (select b.cod_prog,

    c.num_arj,

    c.cod_itens,

    c.DSC_ITEM,

    c.COD_SEST_CONJ

    of pcm_desenho b

    INNER JOIN TABLE (fu_pcm_Combinar_Subestacao ('SYSTEM', b.cod_prog, b.num_arj, 0, null, null, null,)) c

    ON b.num_arj = c.num_arj

    and b.cod_prog = peCod_Prog) d

    ON a.cod_sest_conj = d.cod_sest_conj

    INNER JOIN pcm_mat_geral e

    ON e.cod_cemb_mat = a.cod_cemb_estc

    WHERE a.cod_prog = peCod_Prog

    loop of the order of a.num_arj, num_ns_i, num_ns_fn)

    / * n : = n + 1 ; Contador linhas * /.

    UTL_FILE.put_line (v_arquivo_out,

    Chr (34) | Chr (32) | rec_. NUM_ARJ | Chr (32) |

    Chr (34) | v_separator | Chr (34) | Chr (32) |

    rec_. DSC_ITEM | Chr (32) | Chr (34) | v_separator |

    Chr (34) | Chr (32) | rec_. COD_PN_SEST | Chr (32) |

    Chr (34) | v_separator | Chr (34) | Chr (32) |

    rec_. COD_CEMB_SEST | Chr (32) | Chr (34) |

    v_separator | Chr (34) | Chr (32) | rec_. DSC_PN_SEST |

    Chr (32) | Chr (34) | v_separator | Chr (34) |

    Chr (32) | rec_. COD_PN_MAT | Chr (32) | Chr (34) |

    v_separator | Chr (34) | Chr (32) | rec_. NUM_NS_I |

    Chr (32) | Chr (34) | v_separator | Chr (34) |

    Chr (32) | rec_. NUM_NS_FN | Chr (32) | Chr (34) |

    v_separator | Chr (34) | Chr (32) | rec_. DSC_OBS |

    Chr (32) | Chr (34) | v_separator | Chr (34) |

    Chr (32) | rec_. IND_POS | Chr (32) | Chr (34) |

    v_separator,

    (FALSE);

    end loop;

    UTL_FILE.fclose (v_arquivo_out);

    src_file: = BFILENAME ('ORA_DIR', psDsc_File);

    DBMS_LOB. FileOpen (src_file, dbms_lob.file_readonly);

    v_content: = utl_compress.lz_compress (src_file);

    v_blob_len: = DBMS_LOB.getlength (v_content);

    V_SDIRECTORY: = TO_CHAR (SYSDATE, ' DD_MM_YYYY_HH24.MI.) SS') |

    ' _RETORNA. CSV. ZIP';

    psDsc_File: = v_sDirectory;

    v_file: = utl_file.fopen ('ORA_DIR',-/ oracle/files/ORADIR/ORA /)

    psDsc_File,

    "WORLD BANK");

    Everything v_pos< v_blob_len="">

    DBMS_LOB. READ (v_content, v_amount, v_pos, v_buffer);

    UTL_FILE.put_raw (v_file, v_buffer, TRUE);

    v_pos: = v_pos + v_amount;

    END LOOP;

    UTL_FILE.fclose (v_file);

    EXCEPTION

    WHILE OTHERS THEN

    IF UTL_FILE.is_open (v_file) THEN

    UTL_FILE.fclose (v_file);

    END IF;

    LIFT;

    END PR_RELAT_CSV;

  • How to download the Csv file with column headers

    Hi all

    This is pavan, using Apex version 4.2.3


    I am trying to download the csv file I followed this link , and I'm able to download excel with headers, when I try to download with headers of this error "'ORA-01858: a non-digit character was found here where was waiting for a digital" I searched in google but could not find the right solution, "


    can anyone help on this please.

    Thanks in advance,


    Kind regards

    Pavan

    This article is 6 years old.

    You should study the solutions that are available for APEX 4.2: data loader or the 'Excel2Collection' plugin (which also manages the CSV files).

    Data Loader

    It is a wizard that generates an Assistant for your application.

    Excel2Collection

    You will use the Excel2Collection (in a single process) to convert the BLOB in a Collection

    Then, in a 2nd address), you just do a "INSERT...". SELECT statement.  Add ' where seq_id > 1 "for files with a header.

    MK

    PS - Use the "EXECUTE IMMEDIATE" article is not necessary.

  • Separator in CSV file analysis

    Hey,.

    I use the HTMDB_TOOLS to analyze my csv files, it works exceptionally well with one exception,
    Because we have users with systems with different regional settings sometimes only the csv separator can be; Instead of

    I searched through the package body and found where we can change the separator, unfortunately my knowledge of writing scripts is not so great for the change: s

    Can someone help me get the analysis to look at either. or, as separator?

    Thanks in advance
    Ozzy
    create or replace PACKAGE BODY htmldb_tools
    AS
        TYPE varchar2_t IS TABLE OF VARCHAR2(32767) INDEX BY binary_integer;
        -- Private functions --{{{
        PROCEDURE delete_collection ( --{{{
        -- Delete the collection if it exists
            p_collection_name IN VARCHAR2
        )
        IS
        BEGIN
            IF (htmldb_collection.collection_exists(p_collection_name))
            THEN
                htmldb_collection.delete_collection(p_collection_name);
            END IF;
        END delete_collection; --}}}
        PROCEDURE csv_to_array ( --{{{
        -- Utility to take a CSV string, parse it into a PL/SQL table
        -- Note that it takes care of some elements optionally enclosed
        -- by double-quotes.
            p_csv_string IN  VARCHAR2,
            p_array      OUT wwv_flow_global.vc_arr2,
            p_separator  IN  VARCHAR2         := ','
            )
        IS
            l_start_separator PLS_INTEGER     := 0;
            l_stop_separator  PLS_INTEGER     := 0;
            l_length          PLS_INTEGER     := 0;
            l_idx             BINARY_INTEGER  := 0;
            l_quote_enclosed  BOOLEAN         := FALSE;
            l_offset          PLS_INTEGER     := 1;
        BEGIN
            l_length          := NVL(LENGTH(p_csv_string),0);
            IF (l_length <= 0)
            THEN
                RETURN;
            END IF;
            LOOP
                l_idx := l_idx + 1;
                l_quote_enclosed := FALSE;
                IF SUBSTR(p_csv_string, l_start_separator + 1, 1) = '"'
                THEN
                  l_quote_enclosed := TRUE;
                  l_offset := 2;
                  l_stop_separator := INSTR(p_csv_string, '"', l_start_separator + l_offset, 1);
                ELSE
                  l_offset := 1;
                  l_stop_separator := INSTR(p_csv_string, p_separator, l_start_separator + l_offset, 1);
                END IF;
                IF l_stop_separator = 0
                THEN
                  l_stop_separator := l_length + 1;
                END IF;
                p_array(l_idx) := (SUBSTR(p_csv_string, l_start_separator + l_offset,(l_stop_separator - l_start_separator - l_offset)));
                EXIT WHEN l_stop_separator >= l_length;
                IF l_quote_enclosed
                THEN
                  l_stop_separator := l_stop_separator + 1;
                END IF;
                l_start_separator := l_stop_separator;
            END LOOP;
        END csv_to_array; --}}}
        PROCEDURE get_records(p_blob IN blob,p_records OUT varchar2_t) --{{{
        IS
           l_record_separator VARCHAR2(2) := chr(13)||chr(10);
           l_last             INTEGER;
           l_current          INTEGER;
        BEGIN
            -- Sigh, stupid DOS/Unix newline stuff. If HTMLDB has generated the file,
            -- it will be a Unix text file. If user has manually created the file, it
            -- will have DOS newlines.
            -- If the file has a DOS newline (cr+lf), use that
            -- If the file does not have a DOS newline, use a Unix newline (lf)
            IF (NVL(dbms_lob.instr(p_blob,utl_raw.cast_to_raw(l_record_separator),1,1),0)=0)
            THEN
                l_record_separator := chr(10);
            END IF;
            l_last := 1;
            LOOP
                l_current := dbms_lob.instr( p_blob, utl_raw.cast_to_raw(l_record_separator), l_last, 1 );
                EXIT WHEN (nvl(l_current,0) = 0);
                p_records(p_records.count+1) := utl_raw.cast_to_varchar2(dbms_lob.substr(p_blob,l_current-l_last,l_last));
                l_last := l_current+length(l_record_separator);
            END LOOP;
        END get_records; --}}}
        --}}}
        -- Utility functions --{{{
        PROCEDURE parse_textarea ( --{{{
            p_textarea        IN VARCHAR2,
            p_collection_name IN VARCHAR2
        )
        IS
            l_index   INTEGER;
            l_string  VARCHAR2(32767) := TRANSLATE(p_textarea,chr(10)||chr(13)||' ,','@@@@');
            l_element VARCHAR2(100);
        BEGIN
            l_string := l_string||'@';
            htmldb_collection.create_or_truncate_collection(p_collection_name);
            LOOP
                l_index := instr(l_string,'@');
                EXIT WHEN NVL(l_index,0)=0;
                l_element := substr(l_string,1,l_index-1);
                IF (trim(l_element) IS NOT NULL)
                THEN
                    htmldb_collection.add_member(p_collection_name,l_element);
                END IF;
                l_string := substr(l_string,l_index+1);
            END LOOP;
        END parse_textarea; --}}}
        
        PROCEDURE parse_file( --{{{
            p_file_name       IN VARCHAR2,
            p_collection_name IN VARCHAR2,
            p_headings_item   IN VARCHAR2,
            p_columns_item    IN VARCHAR2,
            p_ddl_item        IN VARCHAR2,
            p_table_name      IN VARCHAR2 DEFAULT NULL
        )
        IS
           l_blob        blob;
           l_records     varchar2_t;
           l_record      wwv_flow_global.vc_arr2;
           l_datatypes   wwv_flow_global.vc_arr2;
           l_headings    VARCHAR2(4000);
           l_columns     VARCHAR2(4000);
           l_seq_id      NUMBER;
           l_num_columns INTEGER;
           l_ddl         VARCHAR2(4000);
        BEGIN
            IF (p_table_name is not null)
            THEN
            
              BEGIN
                execute immediate 'drop table '||p_table_name;
              EXCEPTION
                WHEN OTHERS THEN NULL;
              END;
              
              l_ddl := 'create table '||p_table_name||' '||v(p_ddl_item);
              htmldb_util.set_session_state('P149_DEBUG',l_ddl);
              execute immediate l_ddl;
              l_ddl := 'insert into '||p_table_name||' '||
                       'select '||v(p_columns_item)||' '||
                       'from htmldb_collections '||
                       'where seq_id > 1 and collection_name='''||p_collection_name||'''';
              htmldb_util.set_session_state('P149_DEBUG',v('P149_DEBUG')||'/'||l_ddl);
              execute immediate l_ddl;
              RETURN;
            END IF;
            
            BEGIN
                select blob_content into l_blob from wwv_flow_files
                where name=p_file_name;
            EXCEPTION
              WHEN NO_DATA_FOUND THEN
                  raise_application_error(-20000,'File not found, id='||p_file_name);
            END;
            
            get_records(l_blob,l_records);
            IF (l_records.count < 2)
            THEN
                raise_application_error(-20000,'File must have at least 1 ROW, id='||p_file_name);
            END IF;
     
            -- Initialize collection
            htmldb_collection.create_or_truncate_collection(p_collection_name);
            
            -- Get column headings and datatypes
            csv_to_array(l_records(1),l_record);
            csv_to_array(l_records(2),l_datatypes);
            l_num_columns := l_record.count;
            if (l_num_columns > 50) then
              raise_application_error(-20000,'Max. of 50 columns allowed, id='||p_file_name);          
            end if;
            
            -- Get column headings and names
            FOR i IN 1..l_record.count
            LOOP
                l_headings := l_headings||':'||l_record(i);
                l_columns  := l_columns||',c'||lpad(i,3,'0');
            END LOOP;
            l_headings := ltrim(l_headings,':');
            l_columns  := ltrim(l_columns,',');
            htmldb_util.set_session_state(p_headings_item,l_headings);
            htmldb_util.set_session_state(p_columns_item,l_columns);
     
            -- Get datatypes
            FOR i IN 1..l_record.count
            LOOP
                l_ddl := l_ddl||','||l_record(i)||' '||l_datatypes(i);
            END LOOP;
            l_ddl := '('||ltrim(l_ddl,',')||')';
            htmldb_util.set_session_state(p_ddl_item,l_ddl);
     
            -- Save data into specified collection
            FOR i IN 2..l_records.count
            LOOP
                csv_to_array(l_records(i),l_record);
                l_seq_id := htmldb_collection.add_member(p_collection_name,'dummy');
                FOR i IN 1..l_record.count
                LOOP
                    htmldb_collection.update_member_attribute(
                        p_collection_name=> p_collection_name,
                        p_seq            => l_seq_id,
                        p_attr_number    => i,
                        p_attr_value     => l_record(i)
                    );
                END LOOP;
            END LOOP;
     
            DELETE FROM wwv_flow_files WHERE name=p_file_name;
       END;
    BEGIN
      NULL;
    END;

    The order of the parameters for the parse_file in the specification and body must match. In your case, it stopped the p_separator parameter (before nom_table_p in spec, but otherway around body) which is the origin of the problem of compiling again.

  • How to navigate through the CSV file by row and pass it by MFL

    I have a CSV file that got no. n. records with the new line ("N") that separates each record of the

    Each record is of about 10 fields or more delimited by ' |'

    for example.

    11111. "20090316152" | " » 0"| » 0"| » 0"| » 0"| » 0"| "1-7DT-439" | " » "||" N ".

    22222 | "20090216152" | " » 1"| » 0"| » 0"| » 0"| » 0"| "1-7DDI-439" | " » "||" N ".

    33333 | "20090316352" | " » 6"| » 0"| » 0"| » 0"| » 0"| "1-5KK-439" | " » "||" N ".

    The requirement is to read the file using OSB - file adapter and move all records to the MFL for the conversion of XML

    Thank you
    Danny

    What happens when you pass all $body as it is the transformation of MFL?

  • Download csv file into the database using apex

    Hi all

    I use apex 4 and express oracle 10g, I need to upload the .csv file in the database for one of my queries, I just discussion forum for solutions, I found too, but some how its does not work for me.

    below mentioned is error and the code


    ERROR:

    ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550 : line 40, column 8: PL/SQL: statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
    Error
    Ok


    CODE:
    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    V_POSITION NUMBER;
    v_raw_chunk RAW (10000);
    v_char char (1);
    number of c_chunk_len: = 1;
    v_line VARCHAR2 (32767): = NULL;
    v_data_array wwv_flow_global.vc_arr2;
    BEGIN
    -Read data from wwv_flow_files
    Select blob_content from v_blob_data
    of wwv_flow_files where filename = "DDNEW.csv";

    v_blob_len: = dbms_lob.getlength (v_blob_data);
    V_POSITION: = 1;

    -Read and convert binary to a char
    WHILE (v_position < = v_blob_len) LOOP
    v_raw_chunk: = dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char: = chr (hex_to_decimal (rawtohex (v_raw_chunk)));
    v_line: = v_line | v_char;
    V_POSITION: = v_position + c_chunk_len;
    -When a whole line is retrieved
    IF v_char = Chr (10) THEN
    -Convert comma to: use of wwv_flow_utilities
    v_line: = REPLACE (v_line, ', ' :'); ")
    -Converting each column separated by: in the data table
    v_data_array: = wwv_flow_utilities.string_to_table (v_line);
    -Insert data into the target table
    EXECUTE IMMEDIATE ' insert into TABLE_X (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)
    "values (: 1,: 2,: 3: 4:5:6,: 7,: 8,: 9,: 10:11).
    USING
    v_data_array (1),
    v_data_array (2),
    v_data_array (3),
    v_data_array (4);
    v_data_array (5);
    v_data_array (6).
    v_data_array (7);
    v_data_array (8);
    v_data_array (9);
    v_data_array (10);
    v_data_array (11);

    -Remove
    v_line: = NULL;
    END IF;
    END LOOP;
    END;



    what I understand of it's system does not identify v_data_array as table for some reasons, please help me.



    initially the system was in error for hex_to_decimal, but I managed to get this feature on the discussion forum, and now it seems to be ok. but v_data_array problem is still there.



    Thanks in advance

    concerning

    Uday

    Hello

    Correct errors in your sample, I have

    Problem 1

    select blob_content into v_blob_data
    from wwv_flow_files where filename = 'DDNEW.csv'; 
    

    TO

    select blob_content into v_blob_data
    from wwv_flow_files where name = :P1_FILE;
    

    Problem 2

    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4);
    v_data_array(5);
    v_data_array(6);
    v_data_array(7);
    v_data_array(8);
    v_data_array(9);
    v_data_array(10);
    v_data_array(11);  
    

    TO

    EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4),
    v_data_array(5),
    v_data_array(6),
    v_data_array(7),
    v_data_array(8),
    v_data_array(9),
    v_data_array(10),
    v_data_array(11);  
    

    And I have created table missing

    CREATE TABLE TABLE_X
      (
        v1  VARCHAR2(255),
        v2  VARCHAR2(255),
        v3  VARCHAR2(255),
        v4  VARCHAR2(255),
        v5  VARCHAR2(255),
        v6  VARCHAR2(255),
        v7  VARCHAR2(255),
        v8  VARCHAR2(255),
        v9  VARCHAR2(255),
        v10 VARCHAR2(255),
        v11 VARCHAR2(255)
      );
    

    Kind regards
    Jari

    Published by: jarola November 19, 2010 15:03

  • need help on download of CSV files

    Hi all

    I need to download a csv file in the table through browse file button. To do this, I created the process and function below. This method works perfectly fine when the file size is small. But I need to download the file size of 16 MB and when I try to download this file it give error wwv_flow.accept. Any expert from the TOP please help me about this error. As I am very new to the APEX, and I need to achieve this as soon as possible. Please provide any solution, I will be really grateful to the person.

    function

    create or replace function hex_to_decimal
    -This function is based on one by Connor McDonald
    -http://www.jlcomp.demon.co.uk/faq/base_convert.html
    (P_hex_str in varchar2) return number
    is
    number of v_dec;
    v_hex varchar2 (16): = '0123456789ABCDEF ';
    Start
    v_dec: = 0;
    for indx in 1... Length (p_hex_str)
    loop
    v_dec: = v_dec * 16 + instr (v_hex, upper (substr(p_hex_str,indx,1)))-1;
    end loop;
    Return v_dec;
    end hex_to_decimal;


    Process of

    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    V_POSITION NUMBER;
    v_clob_data CLOB: = 'nothing. '
    dest_offset NUMBER: = 1;
    offset NUMBER: = 1;
    blob_csid NUMBER: = dbms_lob.default_csid;
    lang_ctx INTEGER: = dbms_lob.default_lang_ctx;
    caveat INTEGER;



    v_raw_chunk RAW (10000);
    v_char char (1);
    number of c_chunk_len: = 1;
    v_line VARCHAR2 (32767): = NULL;
    v_data_array wwv_flow_global.vc_arr2;
    number of v_rows;
    number of v_sr_no: = 1;


    BEGIN


    delete from scg_recievables2;


    -Read data from wwv_flow_files
    Select blob_content from v_blob_data
    of wwv_flow_files
    where last_updated = (select max (last_updated) in the wwv_flow_files where UPDATED_BY =: APP_USER)
    and id = (select max (id) in the wwv_flow_files where updated_by =: APP_USER);



    v_blob_len: = dbms_lob.getlength (v_blob_data);
    V_POSITION: = 1;


    -Read and convert binary to a char
    WHILE (v_position < = v_blob_len) LOOP
    DBMS_LOB.converttoclob (v_clob_data, v_blob_data, v_blob_len, dest_offset, offset, blob_csid, lang_ctx, warning);
    v_char: = dbms_lob.getlength (v_clob_data);


    v_line: = v_line | v_char;
    V_POSITION: = v_position + c_chunk_len;
    -When a whole line is retrieved < / span >
    IF v_char = Chr (10) THEN
    -Convert comma to: use of wwv_flow_utilities
    v_line: = REPLACE (v_line, ';', ' :');)
    -Converting each column separated by: in the data table
    v_data_array: = wwv_flow_utilities.string_to_table (v_line);
    If IsNumber (substr (v_data_array (9), 1, 1)) = 1 then
    v_data_array (9): = substr (v_data_array (9), 1, 11);
    on the other
    v_data_array (9): = January 1, 1900 ";
    end if;
    v_data_array (9): = NVL (v_data_array (9),'' 01-JAN-1900);
    -Insert data into the target table
    EXECUTE IMMEDIATE ' insert into scg_recievables2 (Account_receivable_number, the_account_number, bill_history_tran, service_number, item_type, the_amount_billed, the_remaining_amount, source_of_payment)


    values (: 1,: 2:3:4: 5: 6: 7: 8,:' 9)
    USING
    v_data_array (1),
    v_data_array (2),
    v_data_array (3),
    v_data_array (4),
    v_data_array (5),
    v_data_array (6),
    v_data_array (7),
    v_data_array (8);
    -Remove
    v_line: = NULL;
    v_sr_no: = v_sr_no + 1;
    END IF;


    END LOOP;
    END;

    You're probably delay with your web server. Check the server logs to see if there are errors...

    Thank you

    Tony Miller
    Webster, TX

    A lady came up to me on the street, pointed at my suede jacket and said: "do you not know that a cow was murdered for that jacket?
    ' I didn't know there are witnesses ', I replied: "now, I'll have to kill you too. '

  • Please help to download a CSV file on APEX by browsing file

    Hi all

    I need to download a csv file in the table through browse file button. To do this, I created the process and function below. This method works perfectly fine when the file size is small. But I need to download the file size of 16 MB and when I try to download this file it give error wwv_flow.accept. Any expert from the TOP please help me about this error. As I am very new to the APEX, and I need to achieve this as soon as possible. Please provide any solution, I will be really grateful to the person.


    _ Function

    create or replace function hex_to_decimal
    -This function is based on one by Connor McDonald
    -http://www.jlcomp.demon.co.uk/faq/base_convert.html
    (P_hex_str in varchar2) return number
    is
    number of v_dec;
    v_hex varchar2 (16): = '0123456789ABCDEF ';
    Start
    v_dec: = 0;
    for indx in 1... Length (p_hex_str)
    loop
    v_dec: = v_dec * 16 + instr (v_hex, upper (substr(p_hex_str,indx,1)))-1;
    end loop;
    Return v_dec;
    end hex_to_decimal;


    _ Process

    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    V_POSITION NUMBER;
    v_clob_data CLOB: = 'nothing. '
    dest_offset NUMBER: = 1;
    offset NUMBER: = 1;
    blob_csid NUMBER: = dbms_lob.default_csid;
    lang_ctx INTEGER: = dbms_lob.default_lang_ctx;
    caveat INTEGER;



    v_raw_chunk RAW (10000);
    v_char char (1);
    number of c_chunk_len: = 1;
    v_line VARCHAR2 (32767): = NULL;
    v_data_array wwv_flow_global.vc_arr2;
    number of v_rows;
    number of v_sr_no: = 1;

    BEGIN

    delete from scg_recievables2;

    -Read data from wwv_flow_files </span >
    Select blob_content from v_blob_data
    of wwv_flow_files
    where last_updated = (select max (last_updated) in the wwv_flow_files where UPDATED_BY =: APP_USER)
    and id = (select max (id) in the wwv_flow_files where updated_by =: APP_USER);


    v_blob_len: = dbms_lob.getlength (v_blob_data);
    V_POSITION: = 1;

    -Read and convert the binary for char </span >
    WHILE (v_position < = v_blob_len) LOOP
    DBMS_LOB.converttoclob (v_clob_data, v_blob_data, v_blob_len, dest_offset, offset, blob_csid, lang_ctx, warning);
    v_char: = dbms_lob.getlength (v_clob_data);

    v_line: = v_line | v_char;
    V_POSITION: = v_position + c_chunk_len;
    -When a whole line is retrieved < / span >
    IF v_char = Chr (10) THEN
    -Convert comma to: to use wwv_flow_utilities </span >
    v_line: = REPLACE (v_line, ';', ' :');)
    -Converting each column separated by: in the data table </span >
    v_data_array: = wwv_flow_utilities.string_to_table (v_line);
    If IsNumber (substr (v_data_array (9), 1, 1)) = 1 then
    v_data_array (9): = substr (v_data_array (9), 1, 11);
    on the other
    v_data_array (9): = January 1, 1900 ";
    end if;
    v_data_array (9): = NVL (v_data_array (9),'' 01-JAN-1900);
    -Insert data into the table target </span >
    EXECUTE IMMEDIATE ' insert into scg_recievables2 (Account_receivable_number, the_account_number, bill_history_tran, service_number, item_type, the_amount_billed, the_remaining_amount, source_of_payment)

    values (: 1,: 2:3:4: 5: 6: 7: 8,:' 9)
    USING
    v_data_array (1),
    v_data_array (2),
    v_data_array (3),
    v_data_array (4),
    v_data_array (5),
    v_data_array (6),
    v_data_array (7),
    v_data_array (8);
    -Remove
    v_line: = NULL;
    v_sr_no: = v_sr_no + 1;
    END IF;

    END LOOP;
    END;

    As mentioned, this disrupts the question, because a possible answer was published in the OTHER thread... Check your server logs, you probably delay... Preliminary discussions with a similar problem:

    Take a look at the httpd.conf file (or get your system administrator to look at it) and see what's on the value of TimeOut. You may need to increase in order to export large tables by APEX.

    http://www.apacheref.com/ref/http_core/timeout.html

    Thank you

    Tony Miller
    Webster, TX

    A lady came up to me on the street, pointed at my suede jacket and said: "do you not know that a cow was murdered for that jacket?
    ' I didn't know there are witnesses ', I replied: "now, I'll have to kill you too. '

Maybe you are looking for

  • Charge of menus (right click, bookmark, etc.) of Firefox VERY slow

    System information:Windows 7 Home Premium, 64-bit.Intel Core 2 Duo 2.53 GHz6 GB memoryIntel SSD 320 series Gradually, for a few years, FireFox has got slower and slower for me. Not really, navigation, but the menus. It takes place in about 3 seconds

  • Satellite L10 193: black screen TV

    Hello When I plug the S-video cable to the s-video output and bind it to my TV with a scartconnector the colors on the screen isn't here. It is black and white. Does anyone know how to fix this?I have a Satellite L10 193 Thank you

  • ~ HELP ~ where is shortened T430 "" right click ".

    I bought the T430, but I can't find the "right click" keyboard in keyboard shortcut, where is he? ". Who can help me? Thank you and thank you

  • Cannot use the WIndows updates in Windows XP

    Original title: re-installed windows XP Home Edition and the service packs, causing problems I recently had to reinstall windows XP home, service Pack 1, 2, and 3.  I can't access updates on the microsoft site.  After the screen that shows that he is

  • Comments on E3000 network / password problem

    Hello I have the E3000, I want to use the comments for a wireless network.  The use of Cisco Connect Add a password to the Guest network. The guest network appears then as open or not secured on laptop and phone.  I renamed my network and changed the