Efficient way to read CLOB data

Hello All,
We have a stored procedure in oracle with CLOB out parameter, when this is executed from java the stored proc is executed fast but reading data from clob datatype using 'subString' functionality takes more time (approx 6sec for 540kb data).
Could someone please suggest what is the efficient way to read data from Clob (We need to read data form clob and write into a file).
Thanks & Regards,
Prashant,

Hi,
you can try buffered reading / writing the data, it usually speeds the process up.
See example here:
http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/advanced/LOBSample/LOBSample.java.html

Similar Messages

  • What is the best, most efficient way to read a .xls File and create a pipe-delimited .csv File?

    What is the best and most efficient way to read a .xls File and create a pipe-delimited .csv File?
    Thanks in advance for your review and am hopeful for a reply.
    ITBobbyP85

    You should have no trouble doing this in SSIS. Simply add a data flow with connection managers to an existing .xls file (excel connection manager) and a new .csv file (flat file). Add a source to the xls and destination to the csv, and set the destination
    csv parameter "delay validation" to true. Use an expression to define the name of the new .csv file.
    In the flat file connection manager, set the column delimiter to the pipe character.

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • Can we read clob data present in oracle database by BPEL

    Hi all,
    Please let me know or help me understand whether we can read clob data(excel file) present in database by BPEL?
    TIA

    Try this one,
    Re: Reading Xml file from clob column in the staging table
    Hope it helps,

  • What is the 'quickest' way to read char data from a txt file

    Hello,
    What is the 'quickest' way to read character data from a txt file stored on the phone to be displayed into the screen?
    Regards

    To be even a bit more constructive...
    Since J2me does not have a BufferedInputStream, it will help to implement it yourself. It's much faster since you read large blocks at ones in stread of seperate chars.
    something line this lets you read lines very fast:
      while ( bytesread < filesize ) {
             length = configfile.read( buff, 0, buff.length );
             // append buffer to temp String
             if ( length < buff.length ) {
                byte[]  buf  = new byte[length];
                System.arraycopy( buff, 0, buf, 0, length );
                tmp.append( new String( buf ) );
             } else {
                tmp.append( new String( buff ) );
             // look in tmp string for \r\n
             idx1 = tmp.toString().indexOf( "\r\n" );
             while ( idx1 >= 0 ) {
                //if found, split into line and rest of tmp
                line = tmp.toString().substring( 0, idx1 );
             /// ... do with it whatever you want ... ////
                tmp = new StringBuffer( tmp.toString().substring( idx1 + 2 ) );
                idx1 = tmp.toString().indexOf( "\r\n" );
             bytesread += length;
          }

  • What's the best way to read JSON data?

    Hi all;
    What is the best way to read in JSON data? And is the best way to use it once read in to turn it into XML and apply XPath?
    thanks - dave

    jtahlborn wrote:
    without having a better understanding of what your definition of "use it" is, this question is essentially unanswerable. Jackson is a fairly popular library for translating json to/from java objects. the json website provides a very basic library for parsing to/from xml. which one is the "best" depends on what you want to do with it.Good point. We have a reporting product ([www.windward.net|http://www.windward.net]) and we've had a number of people ask us for JSON support. But how complex the data is and what they want to pull is all over the place. The one thing that's commin is they generally want to pull down the JSON data, and then put specific items from that in the report.
    XML/XPath struck me as a good way to do this for a couple of reasons. First it seems to map well to the JSON data layout. Second it provides a known query language. Third, we have a really good XPath wizard and we could then use it for JSON also.
    ??? - thanks - dave

  • Best way of reading clob and loadng into table

    Hi,
    I'm loading the data from clob to one of our table. For this task its taking 10 minutes for 8,000 records. Down the road we are expecting more than 20,000 records.
    Is there any fastest way to load the data in this approach. please help me out
    sournce table is lob_effect1 and target table canbe any table.
    CREATE TABLE lob_effect1 (
      id  INTEGER NULL,
      loc CLOB    NULL
      STORAGE (
        NEXT       1024 K
    CREATE OR REPLACE FUNCTION f_convert(p_list IN VARCHAR2)
        RETURN varchar2
      AS
        l_string       VARCHAR2(32767) := p_list || ',';
        l_comma_index  PLS_INTEGER;
        l_index        PLS_INTEGER := 1;
       -- l_tab          test_type := test_type();
          v_col_val                         varchar2(32767);
       v_col_val_str            varchar2(32767);
      BEGIN
        LOOP
         --     dbms_output.put_line(l_string);
          l_comma_index := INSTR(l_string, ',', l_index);
                   EXIT WHEN l_comma_index = 0;
          v_col_val := SUBSTR(l_string, l_index, l_comma_index - l_index);
                   v_col_val_str :=v_col_val_str ||','||chr(39)||v_col_val|| chr(39);
                   v_col_val_str :=ltrim(v_col_val_str,',');
              --     dbms_output.put_line(v_col_val_str);
          l_index := l_comma_index + 1;
        END LOOP;
        RETURN v_col_val_str;
      END f_convert;
    CREATE OR REPLACE
    PROCEDURE p_load_clob1(
        p_date     IN DATE DEFAULT NULL,
        p_tab_name IN VARCHAR2,
        p_clob     IN CLOB DEFAULT NULL)
    IS
      var_clob CLOB;
      var_clob_line            VARCHAR2(4000);
      var_clob_line_count      NUMBER;
      var_clob_line_word_count NUMBER;
      v_col_val                VARCHAR2(32767);
      v_col_val_str            VARCHAR2(32767);
      v_tab_name               VARCHAR2(200):='coe_emea_fi_fails_new_tmp';
      v_sql                    VARCHAR2(32767);
      n_id                     NUMBER;
      CURSOR cur_col_val(p_str VARCHAR2)
      IS
        SELECT * FROM TABLE(fn_split_str(p_str));
    BEGIN
      INSERT
      INTO lob_effect VALUES
          seq_lob_effect.nextval,
          p_clob
      RETURNING id
      INTO n_id;
      COMMIT;
      SELECT loc INTO var_clob FROM lob_effect1 WHERE id =n_id;
      var_clob_line_count := LENGTH(var_clob) - NVL(LENGTH(REPLACE(var_clob,chr(10))),0) + 1;
      FOR i                                  IN 1..var_clob_line_count
      LOOP
        var_clob_line           := regexp_substr(var_clob,'^.*$',1,i,'m');
        var_clob_line_word_count:=LENGTH(var_clob_line) - NVL(LENGTH(REPLACE(var_clob_line,',')),0) + 1;
        v_col_val_str           :=NULL;
        v_col_val               :=NULL;
        FOR rec_col_val         IN cur_col_val(var_clob_line)
        LOOP
          v_col_val     :=rec_col_val.column_value;
          v_col_val_str :=v_col_val_str ||','||chr(39)||v_col_val|| chr(39);
          v_col_val_str :=ltrim(v_col_val_str,',');
        END LOOP;
        v_sql :='insert into '||p_tab_name||' values ('||v_col_val_str||')';
        EXECUTE immediate v_sql;
      END LOOP;
      COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line('Error:' || SQLERRM);
    END;
    /Thanks & Regards,
    Ramana.

    Thread: HOW TO: Post a SQL statement tuning request - template posting
    HOW TO: Post a SQL statement tuning request - template posting

  • Reading CLOB data using jdbc thin driver

    Hi,
    When I try reading data for a CLOB column using thin jdbc driver, I get the following error message
    "Exception: ORA-06550: line 1, column 22:
    PLS-00302: component 'GETCHUNKSIZE' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored".
    This error message is displayed when the call is made to get the character stream from the Clob object.
    Do I need to any server side setup before I can access CLOB data from the database?
    thanks.
    Puru Balakrishnan

    I updated to the latest jdbc drivers, 816classes12b.zip, and the problem went away.
    null

  • What is the most efficient way to pass LV data to a dll?

    For efficiency, this question primarily becomes important when passing large arrays, structures containing large arrays, or generally, any large block of data to a dll.
    The way the dll setup appears and the .c file it create for the dll call, it appears that labVIEW directly passes data in whatever native passing format LV requires without copying the actual data if you select the "Adapt to Type" as the "Type" option. If I pass an array, for example, the .c file contains the type definition of a labVIEW array, i.e., (size,data), and depending whether I select handle or handle pointer, the data passed is either a handle or handle pointer to the array. Likewise, if I pass a LV structure, the .c file will con
    tain the typedef to the structure and the data passed is either a pointer, or pointer to a pointer. These are, I believe, labVIEW native types and do not require copying.
    On the other hand if an array is passed as an array type, then it is converted to a C array that requires LV to copy the array on both sides of the call.
    I further assume all structures can be passed to the memory manager to be manipulated, although I'm actually not sure that you could resize an array pointer in the dll. That seems a bit dubious, but then I guess upon return LV could query the memory manager to determine the array pointer size.
    That�s how I would think things work. If not, could someone please correct me?
    Kind regards,
    Eric

    Eric,
    Let me tell you something about me too...
    I've been working with LabVIEW for (just) 4 years. That is, 40 hours a week
    professionally, 10 hours a week privatelly. I've started with LV4, and went
    through all versions and revisions until 6.0.2 (6.1 will come soon, but
    first I have to finish some major projects.
    During this time I've been working on lots of interfaces with the windows
    OS. Some 'dll' things I've worked on: OpenGL interface, MSXML driver,
    keyboard hooks, mouse hooks, GDI interfacing, calling LV dll's from
    assembler, calling assembler dll's from LV, creating threads, using serial
    interrupts, etc. I'm now (also) working on a way to automatically generate
    documentation (much more then the 'export VI stings') from a VI. This
    requires 'under the hood' knowledge about how VI's work.
    When I had to make a fast routine for a project one time, I choose
    assembler, because I had this knowledge. Also, I wanted to use pure SIMD
    opperations. The operation had to modify an array of DBL's. The SIMD uses
    the same format (IEEE 754, I think), so it was easy. But when it came to
    testing, it appeard that the routine only paid off if the routine was 'long'
    enough. The routine was n*O^2, where n was a parameter. When the array was
    large, and n small, the overhead of copiing the array to modifiable memory
    was relativelly large, and the LV routine was faster.
    When I get a pointer to a LV array, I can use this pointer to modify the
    data in the array. This can (I think) only be done if LV copied this data,
    just like LV is doing when a wire is split to be modified.
    It might be that this copiing can be prevented, e.g. by using other data
    types, or fiddling with threads and reentrance... If you want to optimally
    benefit from dll's I'd look for a way to keep the data in the dll space, or
    pass it once at initialisation. You could use CreateHeap, HeapAlloc,
    AllocGlobal, and other functions. You can use these functions in LV, or in
    the dll. Once you have a pointer to the (one and only) data space, you can
    use this to pass to the dll functions.
    I think LV does not show the memory in question in the profiler, but I'm not
    sure.
    Using the "Adapt to type" option might just result in a internal convertion
    during 'compile' time, and might be exactly the same as doing it yourself.
    Perhaps you can share a bit about the application you are making, or at
    least why you need the speed you are seeking?
    Regards,
    Wiebe.
    "Eric6756" wrote in message
    news:50650000000500000025C60000-1042324653000@exch​ange.ni.com...
    Greg,
    There are two relevant documents which are distributed with labVIEW,
    in labVIEW 6i, (hey, I'll get around to upgrading), the first is
    titled, "Using External Code in LabVIEW", the second is application
    note 154, "LabVIEW Data Formats".
    Actually, a statement Wiebe@air made on my previous question regarding
    dll calls, "Do dll calls monopolize the calling thead?" provoked this
    line of questions. Based on other things he has said, I gather he is
    also using dlls. So as long as we're here let me ask the next
    question...
    If labVIEW must make a copy of the passed data, does it show up as
    additional memory blocks in the vi profiler? In other words, can you
    use the profiler to infer what labVIEW is doing, or as you put it,
    infer whether there is a clever passing method available?
    As a personal note Greg:
    First, as a one time engineering student and teaching assistant, I
    don't recall hearing or using the terms "magical", or "clever". Nor I
    might add, do I find them in print elsewhere in technical journals.
    While I don't mind NI marketing in their marketing documents, used
    here in this mostly educational forum, they strike me as arrogant,
    and/or pompous.
    I like NI's products because they work and are reliable. I doubt it
    has anything to do with magic, has somewhat more to do with being
    clever, but is mostly due to the dogmatic persistence of your
    engineers. I rather doubt any of them adjoin the term "magical" or
    even "clever" to their solutions. I believe the term "best" is
    generally accepted with the qualifier "I've or we've found". At
    least, that has been my engineering experience.
    Second, many of my questions I can sort out on my own, but I figure as
    long as your willing to answer the questions, then your answers are
    generally available to others. The problem is that one question seems
    to lead to another and specific information gets buried in a rather
    lengthy discourse. When I come here with a specific question, it
    would be nice to find it asked and answered specifically rather than
    buried in the obscurity of some other question. As such, at some
    point in these discussions it might be appropriate to reframe a
    question and put at the top. In my opinion, that decision is
    primarily yours as you have a better feel for the redundancy of
    questions asked and/or your answers.
    Anyway, the next question I'm posting at the top is, "Do the handles
    passed to a dll have to be locked down to insure other threads don't
    move the data?"
    Thanks,
    Kind Regards,
    Eric

  • Efficient way to read through big explain plan and genterate html explain plan for sql id's executed in past

    Hi,
    I have a sql which is recently having a performance problems in Production. I have generated a explain plan for it trying to find out what it is doing but plan itself is close to 1000 lines. I want to check if there is any efficient way to go through big plan like this one and quickly find the damaging areas..
    2) I also wanted to know if there is way to generate explain plans in HTML format which executed in past and have entry in dba_hist_sqltext.
    3) I also have two sql_monitor reports which I want to compare. is there any efficient way to do it as well?
    Please share your thoughts!
    Thanks in advance!
    Regards,
    Suman-

    Hi,
    I suggest you can try running sql advisor on the query maybe something fruitful comes up
    http://www.oracle-base.com/articles/11g/sql-access-advisor-11gr1.php
    I am not sure about the explain plan being printed in html format but
    You may also want to try the sqlhistory.sql query from below page
    http://evdbt.com/scripts/
    I have used it many times to check on executions and explain plans which may have changed over the period
    I have faced it many times , the query picks up a bad explain plan and performs poorly

  • What's the best way to read/write data from a file (preferabl​y a *.txt file)?

    As in the title.  l have revived a couple of old VIs to read and write three numbers and a 1D array of clusters to/from a *.txt file.  The functionality is not very user friendly, and it would also be useful if one could open the text files (manually - not through LabVIEW) and still be able to see/understand what was there.
    I was wondering if anyone would be able to come up with a more efficient and/or user friendly method (compatible with lv6.1) 
    James
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    Read Spec.vi ‏110 KB
    Write Spec.vi ‏58 KB

    My primary goal is to have something that works and is easy and comprehensive to operate.  Generating a human-readable file is just a bonus but would be nice if it could be achieved.
    I enclose pictures of the initial file dialog (for both loading and saving the data - referred to as Spec(s) from hence forth), and of the front panel screen seen when  a) loading a spec and  b) saving a spec.  In the file dialog, you have to already know the exact string to input else you'll just be told the file doesn't exist (applies for both loading and saving).  When saving a spec, you cannot see any files previously saved, nor even any previous specs saved within the file.  This means that one can unwittingly overwrite specs without realising it.
    I'm not sure if I've explained this very well, but the current functionality means that far too much can go wrong.  Additionally, if you forget the file name, you'll have no way of knowing what it should be (the data files are stored on a 'locked' part of our network accessible only by Admin or through the LabVIEW executable
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    File Dialog.JPG ‏23 KB
    Select The Required Test Spec.JPG ‏10 KB
    Name of specification.JPG ‏6 KB

  • How to read clob data into a table

    Hi we have application which take oracle reports(10G)  xml  file as input and runs the report and save the output(csv,pdf) in a table.
    so i need some idea to impliment the follwoin task .
    I need to read the  content of the out file whcih in table stored in CLOB(I have not checked yet) column and store the data into another table .
    FYI: The out put  of the report will have 10+ different column.
    could Some please point me to the right direction  to acomplis h the task .
    Thnaks In Advance.Edited by: 852112 on Apr 13, 2011 10:47 AM

    Welcome to the forum.
    See:
    http://www.oracle-base.com/articles/8i/ImportClob.php
    http://www.oracle-base.com/articles/8i/ImportBlob.php

  • Is there any way to read the data from an excel file w/o using a loop structure?

    I am retrieving a large amount of data (multiple sheets) from an excel file and would like to extract the entire range without retrieving individual cell values(too slow). I can write an range all at once but cannot read it.

    If you are able to write a block of data, then you should be able to read a block. The four requirements that you want to verify are:
    1. The Range specified must match the exact size and location of the data block you want to read
    2. The returned data is in a 2D array of Variants (either strings or numbers)
    3. Use Variant to Data to convert to 2D DBL or 2D Strings
    4. Check for the correct orientation for your application (use transpose if it is not)
    Michael Munroe
    Certified LabVIEW Developer
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • Is there a way to read TCPIP data so that it doesn't hang when there is no data present?

    Hi,
    I've got a loop in my code that uses a TCP read function. My problem is that the loop hangs if there is no data available. What I would like to do is check if there is data available, then do the read otherwise move on to the rest of the code if no data is available and then try again on the next loop.
    Thanks,
    Ryan
    Solved!
    Go to Solution.

    In addition to using a non-standard timeout, such as 100ms or so, one can also play with the Read Mode input of the TCP Read. Those modes are a bit pesky and not always trivial to understand but they can be useful. Read the documentation to the TCP Read function that explains these modes a bit and then start to make small experiments to verify your understanding of those operations.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Efficient way to copy business data from Production DB to Test DB

    Hi.
    I'm a DBA in a software dev company.
    The testing team people ask me replicate a customer (and all its data) from the System-Test DB to a DB of a certain tester.
    Problem is the CUSTOMER table has releations to 6 other tables (ORDERS, ORDER_ITEMS, CONTACTS, etc) which in turn has relations to other tables.
    As I see it I have two options:
    1. Copy the entire System Tests DB to the other DB. This is bad - this DB is very large and we don't have enough disk space.
    2. Work out manually all the relations of the CUSTOMER and write a script to copy just the relevant tables/records for the specific customer. This seems too much work...
    Anybody familiar with a script/tool to perform this?

    Ok.. I gave this tool a test run. Pretty impressive.
    It allows you to set a 'root' entity (Customer in my case) and then it calculates all the relations by reading my schema's foreign-keys. I have one table that is logically connected, but has no FK defined in my schema. No problem - I can add this relation manually.
    Now, I need to set the WHERE on my root entity (e.g. CUSTOMER_ID = 1234567) and the tool just shows me all the relevant tables with only the appropriate records displayed. Charm!
    Lastly, I copied the tables/record to my test DB (the tool has a 'Sync' window).
    Mission accomplished.

Maybe you are looking for

  • Goods Receipt for Inbound HU - WS_DELIVERY_UPDATE

    Hi All, I have a requirement to automate transaction VL60p to do GR for an inbound delivery with HU. Since this is a SAP enjoy transaction I can't use BDC and there doesn't seem to be a BAPI for this. I plan to use WS_DELIVERY_UPDATE, filling tables

  • CVD IMPORT urgent

    hi I amfacing problem in import purchase CVD value is Imposing on material value (i.e it in non cenvatable & is should be cenvatable it should not added to material value because we take CENVAT credit for CVD amount ) entries are like this Creation o

  • Apple iPod USB Power Adapter - ?

    Hello everybody! I've got a problem with my new iPod mini and I hope you may help me. After updating the new software for my iPod Apple told me to charge the battery with a Apple iPod USB Power Adapter which I don't have. I tried to connect the iPod

  • Screen Sharing from Mac 2 Mac Help!!!! ASAP!!!

    Hello! I have two MacBooks, how can I set up Screen Share so I can see what the other laptop is doing from my laptop without the other Macbook knowing / Needing to accept permission? I'm trying to set up all kinds of parental controls

  • Enable Email Notification in 10g

    When I am trying to install oracle 10 in windows xp, couldn't enable the email notification. I entered it as "smtp.expolanka.com,smtp.webmail.expolanka.com" like wise. But it says "Enter valid smtp server". Pls help on this matter.