Loading Clob and Blob data using DBMS_LOB

I am loading some data into a table that has five columns, two of which are defined as BLOB and CLOB respectively. I get the following errors after the pl/sql procedure that loads it has completed running :
ERROR:ORA-21560: argument 3 is null,
invalid, or out of range
ERROR:ORA-22297: warning: Open LOBs exist
at transaction commit time.
The following is the outline of the code that loads the table:
CREATE OR REPLACE PROCEDURE load_data(dir,seq_val,file_name,
details, etc <== all these are passed in) IS
dest_loc BLOB;
src_loc BFILE;
Amount INTEGER;
new_dir string(1000);
new_file string(1000);
BEGIN
new_dir := ''||dir||'';
new_file := ''||file_name||'';
src_loc := BFileName(new_dir,new_file);
Amount := dbms_lob.getlength(src_loc);
insert into table A
(id
,ver
,ver
,fil_nm <== This field is a BLOB
,details <== This Field is a CLOB
values
(seq_val
,1
,version
,empty_blob()
,detailed_infor
--dbms_output.put_line(Amount);
SELECT fil_nm INTO dest_loc FROM table A WHERE id = seq_val FOR UPDATE;
/* Opening the LOB is mandatory: */
--dbms_output.put_line('IN SELECT...');
DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
/* Opening the LOB is optional: */
DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE(dest_loc, src_loc, Amount);
/* Closing the LOB is mandatory if you have opened it: */
DBMS_LOB.CLOSE(dest_loc);
DBMS_LOB.CLOSE(src_loc);
--dbms_output.put_line('After SELECT...');
COMMIT;
END
Any feedback would be really appreciated. Thanks.

I assume thats when the ORA-21560: argument 3 is null, invalid, or out of range error occurs. I'm also wondering why and what the other error means saying LOBs are open during transaction commit time. The data is coming from an xml file that is in the following format.
- <NAME>
<FIL_NM>TEST.PDF</FIL_NM>
<VER>2</VER>
<DETAILS>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxyyyyyyyyyyyyyyyyyyzzzzzzzzzmmmmmmsusssuitttttretc</DETAILS>
</REPORT>
<NAME/>
So what this procedure is doing is opening the pdf and loading the data into the BLOB. I just can't understand what is causing those errors.

Similar Messages

  • How to use clob or blob data type in OWB

    how to use clob or blob data type in OWB?
    if OWB not surport these data type,how can i extract the large data type from data source

    The same question was asked just two days ago No Data Found: ORA-22992
    Nikolai Rochnik

  • How we handle CLOB and BLOB Datatypes in HANA DB

    Dear HANA Gurus,
    We have would like to build EDW using HANA base on our source system Oracle and it's supports CLOB and BLOB datatypes
    Would you please suggest how do we handle in HANA DB.
    Let not say it's oracle specific.
    Regards,
    Manoj

    Hello,
    check SAP HANA SQL Reference Guide for list of data types:
    (page 14 - Classification of Data Types)
    https://service.sap.com/~sapidb/011000358700000604922011
    For this purpose might be useful following data types:
    Large Object (LOB) Types
    LOB (large objects) data types, CLOB, NCLOB and BLOB, are used to store a large amount of data such as text documents and images. The maximum size of an LOB is 2 GB.
    BLOB
    The BLOB data type is used to store large binary data.
    CLOB
    The CLOB data type is used to store large ASCII character data.
    NCLOB
    The NCLOB data type is used to store a large Unicode character object.
    Tomas

  • How to create the Export Data and Import Data using flat file interface

    Hi,
    Request to let me know based on the requirement below on how to export and import data using flat file interface.....
    Please provide the steps involved for the same.......
    BW/BI - Recovery Process for SNP data. 
    For each SNP InfoProvider,
    create:
    1) Export Data:
    1.a)  Create an export data source, InfoPackage, comm structure, etc. necessary to create an ASCII fixed length flat file on the XI
    ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider. 
    1.b)  All fields in each InfoProvider should be exported and included in the flat file. 
    1.c)  A process chain should be created for each InfoProvider with a start event. 
    1.d)  If the file exists on the target drive it should be overwritten. 
    1.e)  The exported data file name should include the InfoProvider technical name.
    1.f)  Include APO Planning Version, Date of Planning Run, APO Location, Calendar Year/Month, Material and BW Plant as selection criteria.
    2) Import Data:
    2.a) Create a flat file source system InfoPackage, comm structure, etc. necessary to import ASCII fixed length flat files from the XI
    ctnhsappdata\iface\SCPI063\Out folder for each SNP InfoProvider.
    2.b)  All fields for each InfoProvider should be mapped and imported from the flat file.
    2.c)  A process chain should be created for each InfoProvider with a start event. 
    2.d)  The file should be archived in the
    ctnhsappdata\iface\SCPI063\Archive directory.  Each file name should have the date appended in YYYYMMDD format.  Each file should be deleted from the \Out directory after it is archived. 
    Thanks in advance.
    Tyson

    Here's some info on working with plists:
    http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Introduc tion/chapter1_section1.html
    They can be edited with any text editor. Xcode provides a graphical editor for them - make sure to use the .plist extension so Xcode will recognize it.

  • ?Working with clob and blob - using Dbms_Lob

    I need to search through a blob and remove some of the data, but having problems working with dbms_lob.erase.
    Reading the documentation, the procedure is supposed to work with either blobs or clobs, but I can't get it to work with the blob.
    Here's what I've coded and it does not work correctly for blobs.
    What have I've done wrong?
    declare
    v_start                   integer;
    v_stop                    integer;
    v_amount                  integer;
    v_max_len                  integer:=32676;
    v_offset                   integer:=1;
    v_new_length               integer;
    v_clob clob;
    v_blob blob;
    begin
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning clob_desc into v_clob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Clob: '||v_clob);
    dbms_lob.erase(v_clob, v_amount, v_start);
    dbms_output.put_line('Clob: '||v_clob);
    rollback;
    update test_clob
    set clob_id = clob_id
    where clob_id = 1
    returning blob_desc into v_blob;
    v_start := 0;
    v_stop  := 0;
    v_amount := 0;
    v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    v_amount := ((v_stop - v_start)+11) ;
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    dbms_lob.erase(v_blob, v_amount, v_start);
    dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    rollback;
    end trg_bui_user_assoc_layout;
    /This is the output
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test

    Well, you left out the table DDL and your insert for sample data (would be nice to have) as well as your Oracle version (pretty much a necessity).
    Since i had to make my own there could be a difference in how you populated your table, but i can't reproduce your findings.
    ME_ORCL?drop table test_clob purge;
    Table dropped.
    Elapsed: 00:00:00.09
    ME_ORCL?
    ME_ORCL?create table test_clob
      2  (
      3     clob_id     number not null primary key,
      4     clob_desc   clob,
      5     blob_desc   blob
      6  );
    Table created.
    Elapsed: 00:00:00.03
    ME_ORCL?
    ME_ORCL?insert into test_clob values
      2  (
      3        1
      4     ,  'this is only a test <property name="Name">SortMode</property>  should leave this alone'
      5     ,  utl_raw.cast_to_raw('this is only a test <property name="Name">SortMode</property>  should leave this alone')
      6  );
    1 row created.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?commit;
    Commit complete.
    Elapsed: 00:00:00.01
    ME_ORCL?
    ME_ORCL?declare
      2  v_start                   integer;
      3  v_stop                    integer;
      4  v_amount                  integer;
      5  v_max_len                  integer:=32676;
      6  v_offset                   integer:=1;
      7  v_new_length               integer;
      8
      9  v_clob clob;
    10  v_blob blob;
    11
    12  begin
    13
    14   update test_clob
    15   set clob_id = clob_id
    16   where clob_id = 1
    17   returning clob_desc into v_clob;
    18
    19   v_start := 0;
    20   v_stop  := 0;
    21   v_amount := 0;
    22
    23   v_start := dbms_lob.instr(v_clob, '<property name="Name">SortMode', v_offset );
    24   v_stop  := dbms_lob.instr(v_clob, '</property>',  v_start );
    25   v_amount := ((v_stop - v_start)+11) ;
    26
    27   dbms_output.put_line('Clob: '||v_clob);
    28
    29   dbms_lob.erase(v_clob, v_amount, v_start);
    30
    31   dbms_output.put_line('Clob: '||v_clob);
    32
    33   rollback;
    34
    35   update test_clob
    36   set clob_id = clob_id
    37   where clob_id = 1
    38   returning blob_desc into v_blob;
    39
    40   v_start := 0;
    41   v_stop  := 0;
    42   v_amount := 0;
    43
    44   v_start := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('<property name="Name">SortMode'), v_offset );
    45   v_stop  := dbms_lob.instr(v_blob, utl_raw.cast_to_raw('</property>'),  v_start );
    46   v_amount := ((v_stop - v_start)+11) ;
    47
    48   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    49
    50   dbms_lob.erase(v_blob, v_amount, v_start);
    51
    52   dbms_output.put_line('Blob: '||utl_raw.cast_to_varchar2(v_blob) );
    53
    54   rollback;
    55
    56  end trg_bui_user_assoc_layout;
    57  /
    Clob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Clob: this is only a test                                            should leave this alone
    Blob: this is only a test <property name="Name">SortMode</property>  should leave this alone
    Blob: this is only a test                                            should leave this alone
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.03
    ME_ORCL?select *
      2  from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.03
    ME_ORCL?

  • Can't use clob and blob

    I just created a new database using dbca with General Purpose as the template, as I've done before. All went well until I tried to create tables that used clob or blob datatypes. I kept getting the error "ORA-03001: unimplemented feature".
    What happened? Was the database created improperly? Is there a way to correct this without recreating the database?
    Thanks

    I just created a new database using dbca with General
    Purpose as the template, as I've done before. All
    went well until I tried to create tables that used
    clob or blob datatypes. I kept getting the error
    "ORA-03001: unimplemented feature".
    I have the same problem but only if I assign a tablespace to the table but not if i leave it to the default tablespace.

  • How do I make a VI that contols a 6534 card take less time to load 1Mbyte and output data ?

    Hello-
    I'm developing a pattern generation burst mode type VI that reads byte characters from a text file, manipulates the bytes that it reads and then outputs the data from a 6534 card. The REQ1 pin is pulled high which makes the card continually output data until the internal buffer is empty. An internal clock is used. The problem is that the size of the file that is read by the VI can be relatively large, in the 1MByte range. After the VI manipulation, the output array is 16 times larger than the input string. So, when the VI reads a 1MByte text file, the output array contains 16 million entries (each array entry is 3 bits by the way). It takes about 20 seco
    nds to run and output data from the 6534 even when reading files that are 200kbyte or so. I'm outputting the data at 5Mbps. I'm not sure where all the delay is coming from. Using the 'Profile VI" function under the 'Tools' menu shows a snapshot of time that really doesn't help me since it only shows that the time is spent in my VI. Is this just the result of loading large files ? Or, is there a way to preload the 1MByte file into the 32MB of RAM on the 6534 card before the VI is actually run. What I mean is that I do have the option in my system to have a time when all text files will somehow be loaded into the 6534 memory, during some initialization period, and then the VI would be run with the text file already loaded. This of course assumes that the delay is loading the file from the harddrive, but since the harddrive transfer speed is fast, I have no idea where to speed things up. Any ideas ? Thanks !

    Your question actually belongs to the Measurement Devices >> Digital IO section since it concerns operating the 653x family of digital boards. You will see other related questions and answers there. In the future, please direct your digital questions to that forum.
    If you are trying to profile your VI, you can break it into different pieces. For instance, you can make a subVI out of the file data manipulation.
    Now, are you doing pattern generation or burst mode handshaking output? From your description of the signal connections, it looks like burst mode. You can double-check in the 653x User Manual at the http://www.ni.com/manuals pages. Still, it looks like you could accomplish your task with pattern generation. There are example VIs for both operations that
    I suggest you start with. They are located in the LabVIEW >> Examples >> Daq >> Digital >> 653x.llb directory.
    It also sounds like you are doing a single buffered operation, where you have a set amount of data that you want to output, and once done, the VI will stop. You are preloading the data to the buffer at DIO Write.vi before the 6534 actually outputs the data with DIO Start.vi when you program like the examples.
    Thus, start with the appropriate example and then add the File I/O to it. You can even test with a smaller file to see the effects. You will also find useful information concerning the 6534 in the KnowledgeBase, particularly KnowledgeBase 298CGF9M "How Many Samples of Data Can I Store in the Onboard Memory of the NI 6534?". You can find this online by going to the http://www.ni.com/support and choosing KnowledgeBase from the Technical Resources pull-down menu. Then, type in keywords to search for, such as "6534".
    Regards,
    Geneva L.
    Applications Engineering
    Nati
    onal Instruments
    http://www.ni.com/ask

  • Load RData and export data.frame

    Hi
    I've been carefully following the related "Using RData in Azure ML" post, but I still cannot extract and export the data.frame with an R script module.
    My RData file (called FINAL_REF.RData) was locally zipped and loaded as a .zip file to my workspace
    I've connected the zip file (called FINAL_REF.zip) to the 3rd port of the R script module
    Knowing that my data.frame (named "FINAL_REF") is the only element in the RData file, I've included this simple code in the module:
            test1: load("src/FINAL_REF.rdata"); maml.mapOutputPort("FINAL_REF");
            test2: df <- load("src/FINAL_REF.rdata"); maml.mapOutputPort("df");
    But none of them worked:
       I get a "Error 0063: Mapped variable must be of class type data.frame at this time." for test1
       I get a "Error 1000: RPackage library exception: Reading output R workspace failed" for test2
    Thanks in advance for your support

    Hi
    The output shows clearly all data.frame columns, at the end it shows the following message
    DllModuleHost Error: 1 : Program::Main encountered fatal exception: Microsoft.Analytics.Exceptions.ErrorMapping+ModuleException: Error 1000: RPackage library exception: Reading output R workspace failed ---> Microsoft.Analytics.Modules.R.ErrorHandling.RException: Reading output R workspace failed ---> System.Text.DecoderFallbackException: Unable to translate bytes [B5] at index -1 from specified code page to Unicode.
    Module finished after a runtime of 00:01:43.8298727 with exit code -2
    Module failed due to negative exit code of -2
    Some fields are strings (song, artist, and album names), so I guess there might be some "weird" characters there ... is it the root cause ? can I locally change these columns to Unicode with R?
    BR
    An extract of the log with the data.frame structure below:
    [ModuleOutput] The following files have been unzipped for sourcing in path=["src"]:
    [ModuleOutput]
    [ModuleOutput] Name Length Date
    [ModuleOutput]
    [ModuleOutput] 1 FINAL_REF.RData 278804268 2015-02-02 10:40:00
    [ModuleOutput]
    [ModuleOutput] Loading objects:
    [ModuleOutput]
    [ModuleOutput] 'data.frame': 6590994 obs. of 24 variables:
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] $ country : Factor w/ 457 levels "","AD","AE","AF",..: NA NA NA NA NA NA NA NA NA NA ...
    [ModuleOutput]
    [ModuleOutput] $ classP01 : Factor w/ 5 levels "","curieux","mainstream",..: NA NA NA NA NA NA NA NA NA NA ...
    [ModuleOutput]
    [ModuleOutput] $ artistid : int 2330 11584 NA 12453 2925 12674 39 1028 NA 1204 ...
    [ModuleOutput]
    [ModuleOutput] $ artistname : Factor w/ 7972 levels "","-M-","!DelaDap",..: 7018 7970 NA 1495 1998 6448 44 719 NA 839 ...
    [ModuleOutput]
    [ModuleOutput] $ songname : Factor w/ 90734 levels "","'39","'5150'",..: 8522 35744 NA 40206 89717 48188 28442 38477 NA 90595 ...
    [ModuleOutput]
    [ModuleOutput] $ albumname : Factor w/ 13751 levels "","'74 Jailbreak",..: 5034 7563 NA 893 8355 10285 4421 6535 NA 67 ...
    [ModuleOutput] $ albumid : int 3196 7803 NA 2933 14642 968 14473 6463 NA 16564 ...
    [ModuleOutput]
    [ModuleOutput] [1] "Saving variable FINAL_REF ..."
    [ModuleOutput]
    [ModuleOutput] [1] "Saving the following item(s): .maml.oport1"
    [ModuleOutput]
    [ModuleOutput] $value
    [ModuleOutput]
    [ModuleOutput] NULL
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput]
    [ModuleOutput] $visible
    [ModuleOutput]
    [ModuleOutput] [1] FALSE

  • Loading time-dependent master data using update rules/transformations

    Hi
    I am trying to load time-dependent master data to an infoobject. It seems that I get an error message on duplicate records if I use a transformation or update rule. Does this only work with direct update ?

    In the DTP you have the option to ignore duplicate records....
    Just select that and then load data...

  • Newbie: stopping attachments and monitoring data use of account

    Just got an iPhone 3GS and have managed to set it up all fine and sync with itunes. Had a Touch before so all ok on that score. I'm sycning with Mobile Me and with iTunes.
    However, I have some questions that I can't find in the manual;
    I have a phone account with 250mb data a month, which I guess isn't much, and I only really want to use the iPhone for mail when I'm out and about. However, I've been receiving emails where-ever I am. Where do I find the setting to switch on email via the phone network on and off?
    I also assume its possible to set the mail account so that only the message, or a part of it comes through so I can limit my data use. How do I do this?
    Is there any way I can monitor my phone, text and data use so I don't exceed my phone tariff?

    I installed an email account using the POP option and couldn't stop attachments downloading.
    when I made this account inactive and installed a new mail account using IMAP option it then gave the option to manually download anything over about 300KB. this is the link from my isp that helped me:
    http://www.netregistry.com.au/support/kb/questions.php?questionid=386
    step 7 is where you select the IMAP option.
    hopefully you are given that option by your ISP/email provider.
    Message was edited by: toger

  • Loading masterdata and transaction data from same flat file

    hi all,
    how can i load master data and transaction data from the same flatfile at a time.

    I am afraid it is possible.
    Go thru this Uploading Master & Transaction Data together from Flat File

  • Attaching BLOB Data using BPEL Process

    Hi,
    I need to upload resume(BLOB Data) into irc_documents.binary_doc(binay_doc is BOLB Data type) by using BPEL Process.
    Could you please let me know the steps to be followed to upload the Binary Document.
    My Contact Mail Id:[email protected]
    Regards,
    Praveen

    by use of for example a opaque schema you should be able to get the data in your process.
    http://soastuff.wordpress.com/2007/06/06/handling-opaque-datatypes-in-bpelesb/
    this might help.
    do you want to send the binary data thrue the whole bpel process, or do you want to get in somewhere in the middle of the process ?

  • External load real and target data in SSM?

    Hi,
    I have a question,
    Can I load the real and target data  in the "metrics manager" module externally?
    Any connector is for this? Can I bring from BW the actual and target data?
    In the "metrics manager" manually load the data ...
    Is there another way to do automatic data loading?
    Thanks for your help..

    Hi,
    You can load data (real and target) with metrics manager, BW connector or directly in PAS.
    Regards,
    Miguel

  • I want to communicate and acquire data using the PC Parallel Port.

    How do I to communicate and acquire data from the PC Parallel Port using Labview.
    Thank you in advance.

    One of the easiest ways is to use the INPORT and OUTPORT VIs. Find what port your parallel port is in and then send data to/receive data from that port. For more information on the port itself, try: http://www.lvr.com/parport.htm#Basics. If you are using NT (I heard some of the other new OS's have the same problem) then you need to download accessHW.zip from the NI site.
    Rob

  • Generate all Months between start and end dates using Parameter

    Hi,
    I have a query in which i have two dates that is Start Date and End Date and now i have to populates all the Months between the date range:
    Start Date : APR-12
    End Date: JUL-12
    Now taking these two values i want the recors as displayed below
    APR-12
    MAY-12
    JUN-12
    JUL-12
    So how can write my SQL query to finish this task
    Thanks

    Sounds easy with single pair of Months:
    with data(st_dt, end_dt) as
      select to_date('JAN-2012', 'MON-YYYY'), to_date('SEP-2012', 'MON-YYYY') from dual
    select add_months(st_dt, level - 1  ) mons
      from data
    connect by level <= months_between(end_dt,st_dt) + 1;
    MONS   
    01-JAN-12
    01-FEB-12
    01-MAR-12
    01-APR-12
    01-MAY-12
    01-JUN-12
    01-JUL-12
    01-AUG-12
    01-SEP-12
    9 rows selected Please ensure to read {message:id=9360002} and post the question correctly with all the mentioned points in the thread. It facilitates the people to understand the problem clearly and provide a solution that is compatible with your Oracle Version.

Maybe you are looking for

  • Problem transferring from iPhoto to iPhone4

    I have imported pictures taken by my iPhone4 to iPhoto, however, when I put them into albums and sync, the photos will not transfer back to the iPhone4.

  • How to build online help for froms

    dear colleague, i need to build an on online help based on word file, meanwhile i need to facilate the search ability in this help and table of content also, can anyone help in how to devlope this function??

  • Action Script Help (Flash 8 ONLY)

    My department currently has a host of training videos we use for online courses. Of course, these are all being delivered as FLVs. Through the Developer's communities, I found a script that allowed me to add a caption file to the video (XML). Now I'd

  • Please.. Help me. I can not open the file(untitled.prproj) which made at Premier Pro CC.

    Hi. I have a big problem. The file which made at Premier Pro CC is never opened at Premier Pro CS6. just the words ' The project appears to be damaged. it cannot reopen. ' appears on the screen. (WTF ...) What should I do...? I've found the solution

  • Simple pivot query

    Hi! I want a pivot for the table below: TST     COD 1     A 1     B 2     A 2     C 3     B 4     B 4     C 5     A 5     B 5     CWhen a use this query i don't get the results on the same row: SELECT tst,      max(case when tst = 'A' then 'x' else n