Update of data stored in BLOB of Oracle

Hi,
During the update of data stored in BLOB, the data integrity disturbance is happening, so it becomes impossible to receive new data with small volume from the BLOB than the data stored in BLOB.

Try searching the forums for oracle and lob, there will be plenty of articles.

Similar Messages

  • Update XML data stored in CLOB Column

    Hi All,
    i am new to Oracle and new to SQL
    i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
    <attrs><attr name="name"><string>Schade</string></attr></attrs>
    i am using the following query for updating the value
    UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
    this query is working fine but it changing the data to the following format
    <attrs><attr name="name">Schade</attr></attrs>
    some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
    any help in this regard will b e much appriciated
    Thanks in Advance
    -Umesh

    Hi,
    You should have created your own thread for this, and included database version.
    This works for me on 11.2.0.2 and 10.2.0.5 :
    SQL> create table t_org ( xml_clob clob );
    Table created
    SQL>
    SQL> insert into t_org
      2  values(
      3  '<Message>
      4  <Entity>
      5  <ASSIGNMENT>
      6  <OAVendorLocation> </OAVendorLocation>
      7  <Vendorid>1</Vendorid>
      8  </ASSIGNMENT>
      9  </Entity>
    10  </Message>'
    11  );
    1 row inserted
    SQL> commit;
    Commit complete
    SQL> select '*' ||
      2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
      3         || '*' as result
      4  from t_org;
    RESULT
    SQL> update t_org set xml_clob =
      2  updatexml(xmltype(xml_clob),
      3  '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
      4  ;
    1 row updated
    SQL> select '*' ||
      2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
      3         || '*' as result
      4  from t_org;
    RESULT
    *LONDON*
    Does the OAVendorLocation really have a whitespace value?
    If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
    Is it your real document? Do you actually have some namespaces?

  • Modifying MS WORD documents stored in BLOBS. (Oracle 9i Release 9.2.0.4.0)

    I have a need to replace a string of characters in an MS Word document that is stored in a BLOB field in an Oracle 9i database.
    Background: We have a large number of MS Word documents (~50,000) and many of them contain links to other Word documents stored on various servers throughout our network. We are moving a number of these servers, thus invalidating these links. I need to be able to update these links without having to open up every one of these documents and doing it manually.
    Is it possible, using PL/SQL, to update these links in these MS Word documents that are stored in Oracle? I have currently written a quick PL/SQL routine that will find the links and provide their location within the document, but I am not sure how I can update them. The problem, as I see it, is that if the characters that I am replacing differ in length than those that are currently in the existing document, then I would have to shift the remaining bytes of the document either left or right to preserve the integrity of the document.
    Is this possible, or should I pursue another option?

    It does not have to manual, but I think you will need to use word to modify and save the documents.
    The most automated process I can think of would be to write a client program to fetch a blob, run word, and have a word macro or add in to make the edits save, and then the client program updates with the new blob.
    With that number of documents, I would probably try to fetch a bunch of blobs and have word process them all before updating them for performance reasons.
    Unfortunately I would have no clue how to do the word automation, but I wouldn't touch those blobs using pl/sql

  • How to retrieve the data stored in BLOB field in MySql using java?

    Hi all!
    i stored a file content into the MySql database in BLOB field.
    and i now want retrieve the data......
    Please help me out in doing the task...........
    Thanx...........

    Thrisha..
    When u get a result set u can have rs.getBlob() function that will give u a BLOB object that can be captured using Blob interface of javax.sql package...
    Blob interface has getBinaryStream, getBytes etc as functions...
    i think i cleared u
    regards
    Shanu

  • Problem in storing  as Blob in Oracle Database from java Program

    Hi All,
    Am trying to store an image of size 80000bytes into Oracle database using setBytes() anndsetBinaryStream() method but I'm unable to store in database.can u please tell me what are the various methods to store the Blob data into the database?
    the ways i'm trying to store in Database :
    1) cstmt.setBinaryStream(2, new ByteArrayInputStream(ltImageArr
    .get(i)), ltImageArr.get(i).length);
    2) cstmt.setBytes(2, ltImageArr.get(i)) ;
    waiting for reply
    please help me out

    hi !
    it seems to be a bug under Oracle 10.2, for which i used this workaround :
    PreparedStatement pstmt =
    con.prepareStatement("INSERT INTO blobtable VALUES (?)");
    Blob blob = BLOB.createTemporary(con, true, BLOB.DURATION_SESSION);
    OutputStream out = blob.setBinaryStream(0);
    out.write(byteValues);
    pstmt.setBlob(1, blob);
    i hope it will help you
    bye !

  • RETRIEVE OF ETXT FILE STORED IN BLOB

    Hi,
    I have a question on utl file. I wrote some text in an utl file (text file) and stored it as blob in data base at back end while my team mate has to retrieve the data stored in blob in front end using java. when he retrieves, the file which i stored as blob is retrieved as html file not as text file i stored initially . when we retrieve a file stored as blob, how a blob file will be retrieved..is it depends on front end programmer or is there any format where a file stored as blob will be retrieved only on that format? Kindly give your expertise on this question

    As Billy said, the passing through correct mime type is the only reliable way. If you have already loaded tons of blobs without providing this information, you may try a small workaround to determine the right mime type for your files by emulating the file utility behaviour in the database - you have to load the /etc/mime-magic or something similar for your os into the database and then compare certain bytes of your lobs with those recorded in the mime-magic file. An example how it can be done is here
    http://articles.techrepublic.com.com/5100-9592_11-5219073.html
    You could so complete the missing information in the database without to unload your data , but you should be aware - this can not replace the need to provide right mime type information by loading into database.
    Best regards
    Maxim

  • How to show an image stored by using SQLLDR as BLOB in ORACLE 10g

    Hi!
    i used SQLLDR to upload images from localhost to my oracle db,
    i saves theme as BLOB`s.
    my problem is:
    i can not view them correctly, showing it using the code below, i get:
    gtìSNEvR=Cm¯ö¾ÆTÿmÖØÏs_û«¬ú ÿSê¯HwýÓ ›[[ü/ñŠÝßSº‡—¢
    does any know what to do?? can help me??
    thank you!
    A.H.S.
    <?php
    echo "<p>Attempting database connection...</p></p>";
    $db_conn = ocilogon("username", "password", "ORACLE_SID");
    if (!$db_conn)
    echo "...FAILED. Check the username, passwd, dbstring given in this script are valid or not.</p>";
    if (OCIError($db_conn))
    $erra=OCIError($db_conn);
    dodberror("SQL Error: $erra $erra[message]");
            exit;
          else
            echo "<p>Connected...</p></p>";
    $table_name="images";
    $stmt = ociparse($db_conn, "select * from $table_name" );
         if (!$stmt)
            echo '<p>parsing error</p></p>';
          if (!ociexecute($stmt,OCI_DEFAULT))
            echo "<font color='red'><p>query execute error!</p></font>";
           echo "<table border=1 cellspacing='0' width='50%'>\n";
           $ncols = OCINumCols($stmt);
           echo "<tr>\n";
           for ($i = 1; $i <= $ncols; $i++) {
                $column_name  = OCIColumnName($stmt,$i);
                echo "<td><b>$column_name</b></td>\n";
           while (OCIFetch($stmt))
               echo "<tr>\n";
            for ($i = 1; $i <= $ncols; $i++)
              $column_name  = OCIColumnName($stmt,$i);
              $column_value = OCIResult($stmt,$i);
              if($column_name=="DATA")  
              //Header("content-type: image/jpg");
               $image = "$column_value->load()";
               echo $column_value;    // gives OBJECT!
               echo "<td><img src='$image' width='48' height='48' align='middle' border='0' alt='not found'> </td>\n";
              //echo "<td><img src='$column_value.jpg' width='48' height='48' a-lign='middle' border='0' alt='not found'> </td>\n"; //works 100%
              //$c1 = '<IMG height=128 width=600 SRC="http://host/' . $row[2] . '">';
                //if ($row[image]) { 
              //header("Content-Type: $row[image_type]"); 
              //print "$row[image]";
                else
              echo "<td><b>$column_value</b></td>\n";
            echo "</tr>\n";
          echo "</tr>\n";
           echo "</table>\n";
          OCIFreeStatement($stmt);
          OCILogoff($db_conn);
        ?>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Do you need to uncomment one of the header() functions? Make sure
    it is called before any text or whitespace is sent.
    Look at the example in PHP 5 Code to Upload and Retrieve an Image (aka BLOB) with Oracle
    -- cj

  • Problem to reproject data stored in Oracle through GeoServer

    Good morning
    I am currently trying to reproject some GIS data into the Antarctic Polar Stereographic projection. (see http://nsidc.org/data/atlas/epsg_3031.html)
    This GIS data to be reprojected has been stored into Oracle (Oracle locator) through mapBuilder or Spatial Console with no specified SRS.
    By default, in my GeoServer, the data is marked as having the SRS:4326 in order to calculate the geographical extension.
    When sending a request to my Geographical server (Geoserver 1.6.3) in order to reproject the data into the Antarctic projection (SRS:3031), i got a white page which means that the projection has not been done correctly.
    My URL to generate this map is: ..?service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3031&format=image/gif&width=1000&height=1000&bbox=-12400000,-12400000,12400000,12400000&layers=fifao:fa_areas
    I know this URL is corrrect because it works perfectly when the data is stored in a shapefile format or in a table in PostGIS but not when it points to a table in Oracle.
    So i would tend to think that the problem is at Oracle level.
    Moreover, i tried to specify some SRS when loading a shapefile in Oracle through MapBuilder or Spatial Console and the result is the same or even worst.
    In fact the GIS data stored in a table generated by MapBuilder with a 4326 SRS, can only be seen partially.
    If anyone could help me understanding why data stored in Oracle can not be reprojected while it works for other GeoDatabase or formats, i would be very grateful?
    Could it be related to the media i used to load shapefile? The fact that i have only a locator license?
    Many thanks in advance for your help and i hope it is clear enough.
    Sylvain

    Good morning
    I am currently trying to reproject some GIS data into the Antarctic Polar Stereographic projection. (see http://nsidc.org/data/atlas/epsg_3031.html)
    This GIS data to be reprojected has been stored into Oracle (Oracle locator) through mapBuilder or Spatial Console with no specified SRS.
    By default, in my GeoServer, the data is marked as having the SRS:4326 in order to calculate the geographical extension.
    When sending a request to my Geographical server (Geoserver 1.6.3) in order to reproject the data into the Antarctic projection (SRS:3031), i got a white page which means that the projection has not been done correctly.
    My URL to generate this map is: ..?service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3031&format=image/gif&width=1000&height=1000&bbox=-12400000,-12400000,12400000,12400000&layers=fifao:fa_areas
    I know this URL is corrrect because it works perfectly when the data is stored in a shapefile format or in a table in PostGIS but not when it points to a table in Oracle.
    So i would tend to think that the problem is at Oracle level.
    Moreover, i tried to specify some SRS when loading a shapefile in Oracle through MapBuilder or Spatial Console and the result is the same or even worst.
    In fact the GIS data stored in a table generated by MapBuilder with a 4326 SRS, can only be seen partially.
    If anyone could help me understanding why data stored in Oracle can not be reprojected while it works for other GeoDatabase or formats, i would be very grateful?
    Could it be related to the media i used to load shapefile? The fact that i have only a locator license?
    Many thanks in advance for your help and i hope it is clear enough.
    Sylvain

  • Getting data stored in ref cursor ( got from store proc in oracle) to excel sheet)

    Hey, I am trying to Get data stored in ref cursor ( got from store proc in oracle) to excel sheet in a virtual folder using ssis. 
    I am getting errors and cant do it. If anyone can help me

    Hi Nabin000,
    The Oracle stored procedure doesn't work with SSIS source adapters such as OLE DB Source because the data provider doesn't provide metadata for the source adapter. To achieve your goal, you can use a Script Component as source to call
    the Oracle stored procedure by using System.Data.OracleClient OracleDataReader, and get the rows and add them to the pipeline buffer. For more information, please see:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d0b3a1b-8792-469c-b0d1-f2fbb9e9ff20/dump-oracle-ref-cursor-into-ms-sql-staging-table-using-ssis
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fcdaa97e-8415-4c3e-8ffd-1ad45b590d57/executing-an-oracle-stored-procedure-from-ssis?forum=sqlintegrationservices 
    http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader(VS.90).aspx 
    Regards,
    Mike Yin
    TechNet Community Support

  • I was wondering when you update and restore i-pod if you loose data stored on apps ( ie levels, and game center info.) ?

    I was wondering when you update and restore a i-pod touch do you lose data stored on your apps ( ie levels and games center info) ?

    Not with an update.
    With a Restore, you do lose the data but, as part of the update procedure, you are given the opportunity to back up that information.  Say "Yes" and later, when asked if you want to load from the backup file, again say "yes."

  • How to Scramble BLOB data stored in Tables

    I have received a directive from the top management, in their drive to comply with security standards, that BLOB data stored in the database ( e.g., Word, Excel, PDF, .... documents) needs to be scrambled in DEV environment.
    I have written up a routine which will scramble CHAR/VARCHAR/NUMBER, as this sounded more logical to me.
    But, have come to a stand-still in figuring out how to scramble binary data??????
    Is this at all possible? To me, it sounds impossible, but I'm open to ideas.
    Has anyone out there thought up of a solution to this?
    If so, please do advice.
    Eager to know.

    Hello Dave & BluShadow,
    Thanks for your responses.
    So, 10g is the answer huh.... That's not going to make people jump with joy, at least they'll hold off on this for now. My other possible alternative, is to have one dummy BLOB each of Word Doc, Excel, PDF, ... and overwrite each actual file attachment with the dummy. I know... I know.. not the best.
    Regarding the management stuff... Hmm... This entire thing comes up because of the policy of refreshing the DEV / TEST environments with the actual production data. They've been doing this for a long long time.... The Good side to this is that they've taken the step in the right direction on this one, though I wish it would have been to totally avoid doing this kind of a refresh and use test data.
    Thanks again. Do let me know if there's anyother alternative too.

  • How does Sharepoint 2013 Server farm using BLOB data, Hyper-V with virtual machines storing the BLOB data?

    Hello Community
        A Sharepoint 2013 Server farm created on a physical server
    stores it's documents in SQL Server according to how SQL Server is setup.
        If a Sharepoint 2013 Server farm is using Hyper-V and Virtual machines
    how is BLOB data stored ?  
        Thank you
        Shabeaut

    Are you looking to use Remote Blob Storage? or RBS of SQL with SP?
    It is going to be same way as it is configured for physical server.
    Thanks, Ashish | Please mark a post helpful/answer if it is helpful or answer your query.

  • Storing data from XML files in Oracle DB

    Hi!
    I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
    public class xmlwritedb
    public static void main(String args[]) throws SQLException
    String tabName = "EMP"; // Table into which to insert XML data
    String fileName = "emp.xml"; // XML document filename
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Initialize a JDBC connection
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
    // Insert XML data from file (filename) into
    // database table (tabName)
    OracleXMLSave save = new OracleXMLSave(conn, tabName);
    URL url = save.createURL(fileName);
    int rowCount = save.insertXML(url);
    System.out.println(" successfully inserted "+rowCount+
    " rows into "+ tabName);
    conn.close();
    But it does not work.
    OracleXMLSave object does not see file name.
    Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
    Thank you.
    Maya.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
    If a java exception is thrown probably during ur install u might have forgotten
    grant javauserpriv to scott;
    grant javasyspriv to scott;
    Thanks
    [email protected]
    <HR></BLOCKQUOTE>
    Thank you!!!

  • Serialization Object and storasge in blob field Oracle 8.1.6

    Hi,
    this is problem with serializing and deserializing when i am storing object serialized in a Blob field Oracle:
    MyObject myObject = new MyObject();
    ByteArrayOutputStream bayos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream (bayos);
    oos.writeObject(myObject);
    oos.flush();
    byte[] buffer = bayos.toByteArray();
    int size = buffer.length;
    oos.close();
    ByteArrayInputStream bayis = new ByteArrayInputStream(buffer,0,size);
    // if the number bytes of serialized myObject > 4kbytes then the insert in Blob field fails down.
    // if the number bytes of serialized myObject < 4kbytes then the insert in Blob field successes.
    // So I only can put in Blob field serialized object with size minus 4k.
    // The code for insert:
    PreparedStatement pstmt = connection.prepareStatement(sqlInsert);
    pstmt.setBinaryStream(1,bayis,size);
    int retCode = pstmt.executeUpdate();
    // The code for read from table Oracle
    rset = stmt.rxecuteQuery(sqlSelect);
    rset.next();
    oracle.sql.BLOB fldBlob = (BLOB)rset.getObject(1);
    InputStream ins = fldBlob.getBinaryStream();
    byte[] buf = new byte[size]
    ByteArrayInputStream bayis = new ByteArrayInputStream(buf,0,size);
    ObjectInputStream ois = new ObjectInputStream(bayis);
    MyObject myObject = (MyObject)ois.readObject();
    Someone knows the reason of the limit of 4Kbyte ?
    Thanks....

    Insert LOBs into Oracle is a 3 step process. You must insert a place holder, and the do a select for update to put the contents into the row. Lets say you have a table called MY_LOB:
    create table MY_LOB (
       MYID NUMERIC(10) NOT NULL,
       MYLOB BLOB DEFAULT EMPTY_BLOB()
    );The 'empty_blob' keyword tells Oracle to put a dummy value in the blob column when a row is initially created. To insert (assuming you have a db connection already):
    conn.setAutoCommit(false);
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    oracle.sql.BLOB myLob = null;
    try
       //Insert the initial row.
       pstmt = conn.prepareStatement("INSERT INTO MY_LOB (MYID) VALUES (?)");
       //Set the PK value
       pstmt.setInt(1,100);
       pstmt.executeUpdate();
       pstmt.close();
       //Lock the row for insertion.  This is needed for large inserts.
       pstmt = conn.prepareStatement("SELECT MYLOB from MY_LOB where MYID = ? FOR UPDATE");
       pstmt.setInt(1,100);
       rs = pstmt.executeQuery();
       if (rs.next())
          myLob = (oracle.sql.BLOB)rs.getBlob(1);
       rs.close();
       pstmt.close();
       //Finally...update the row with the blob data....
       myLob.putBytes(1, buffer);
       pstmt = conn.prepareStatement("UPDATE MY_LOB SET MYLOB = ? WHERE MYID = ?");
       pstmt.setBlob(1, myLob);
       pstmt.setInt(2,100);
       pstmt.executeUpdate();
       pstmt.close();
       conn.commit();
    catch(SQLException sqlE)
        conn.rollback();
    finally
      //make sure and close all statements....
    }Hope this helps, I didn't compile it so it may have some bugs. It should lead in the right direction at least.

  • Trying to Insert an XML Element into XML data stored in CLOB column

    Hi all,
    My ORACLE DB version is:
    ('Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit 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');
    I have this XML data stored in a CLOB column:
    <Activity>
         <Changes>     
         </Changes>
         <Inserts>     
         </Inserts>
         <Definition>     
         </Definition>
         <Assignment TYPE="Apply">     
         </Assignment>
         <Spawned>
              <Activity>576D8CD9-57A1-8608-1563-8F6DC74BDF3C</Activity>
              <Activity>11226E79-5D24-02EB-A950-D34A9CCFB3FF</Activity>
              <Activity>DAA68DC0-CA9A-BB15-DE31-9596E19513EE</Activity>
              <Activity>93F667D6-966A-7EAD-9B70-630D9BEFDDD2</Activity>
              <Activity>FA63D9D3-86BB-3FF0-BE69-17EAA7581637</Activity>
         </Spawned>
         <SpawnedBy>AFC49BD4-5AA7-38C0-AE27-F59D16EE1B1C</SpawnedBy>
    </Activity>
    I am in need of some assistance in creating an update that will insert another <Activity>SomeGUID</Activity> into the <Spawned> parent.
    Any help is greatly appreciated.
    Thanks.
    Edited by: 943783 on Dec 14, 2012 12:58 PM

    See XML updating functions : http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb04cre.htm#i1032611
    For example :
    UPDATE my_table t
    SET t.my_clob =
          XMLSerialize(document
            insertChildXML(
              XMLParse(document t.my_clob)
            , '/Activity/Spawned'
            , 'Activity'
            , XMLElement("Activity", 'Some GUID')
    WHERE ...
    ;Although it works, there's overhead introduced by parsing the CLOB, then serializing again.
    Is there any chance you can change the CLOB to SECUREFILE binary XMLType storage instead?
    You would then be able to benefit from optimized piecewise update of the XML and improved storage.

Maybe you are looking for

  • DBMS_SQLHASH.GETHASH() with bind variable?

    Hi: I want to use the dbms_sqlhash.gethash() function but the query that would be the base query has parameter that won't be know until run time. Is there a way to do this? Perhaps I need to parse/evaluate the query first into a string or something a

  • Is there a way to create the illusion of a looping landscape made up of 3D layers?

    The idea is to create a landscape with mountains as individual layers in 3D space. We want to give the illusion that the camera is passing by them - tracking right to left - yet have it to where the landscape keeps the appearance of a loop. The resul

  • Error scheduling a Program in CMC

    I am trying to schedule a program in the CMC. We are on BOXI 31. SP6. Our SIA runs under a local service account. If I change the SIA to run as Local System and then schedule the program in the CMC and provide the local service account details in the

  • How do I reduce an image filesize in iPhoto?

    The forum suggests it is possible, but i can't figure out how...

  • OracleDataAdapter.InsertCommand example code

    Can anyone direct me to an example of using the OracleDataAdapter.Update method on a DataTable with an added row that uses a parameterized stored procedure call? So the OracleDataAdapters.InsertCommand would be set. Thanks