Help!!urgent!!can not insert/update clob:the row containing the lob is not locked

Hi,
could you do me help?
i can not insert a string into a oracle clob field, it echo as:
ORA22920 row containing the lob value is not locked. ORA 06512 at "SYS.DBMS_LOB" line 708
ORA 06512 at line 1;
what its means? please.
my table defined as : create table clob1(id number(5),mclob clob default empty_clob()); the id is create by a sequece of test_sequence automaticly.
my code as belows:
import java.io.*;
import java.sql.*;
//import oracle.sql.*;
public class test4 {
public static void main(String args[]) {
String url_String
= "jdbc:oracle:thin:test/test@myhost:1521:myorcl";
try {
Class.forName
("oracle.jdbc.driver.OracleDriver");
java.sql.Connection con =
java.sql.DriverManager.getConnection(url_String);
con.setAutoCommit(true);
Statement stmt
=con.createStatement();
String sqlStr ="insert into
clob1 (mclob) " + "values(empty_clob())";
stmt.executeUpdate(sqlStr);
String query = "select
test_seq.CURRVAL from dual";
ResultSet rs =stmt.executeQuery
(query);
rs.next();
int currval =rs.getInt(1);
query = "select * from clob1 where
id="+currval;
String str
="abcedefhijklmnopqrstuvwxyz";
rs =stmt.executeQuery(query);
rs.next();
java.sql.Clob clob1
=rs.getClob(2);
oracle.sql.CLOB clob=
(oracle.sql.CLOB)clob1;
System.out.print(clob);
java.io.Writer
wr=clob.getCharacterOutputStream();
wr.write(str);
wr.flush();
wr.close();
stmt.close();
con.close();
} catch(Exception ex) {
System.err.println("SQLException: "
+ ex.getMessage());
null

Hi,
To avoid ORA-22920 error while selecting lob column, use the 'for update' clause in the select statement like :
query = "select * from clob1 where id="+currval+" FOR UPDATE" ;
This should solve the problem. However, after fixing this, you might get the error :
java.sql.SQLException: ORA-1002: fetch out of sequence
I got this error when testing your code. To avoid this error, before executing 'select ... for update' statement Set AutoCommit to OFF, like :
query = "select * from clob1 where id="+currval+" FOR UPDATE" ;
con.setAutoCommit(false);
rs =stmt.executeQuery(query);
Hope that Helps,
Srinivas

Similar Messages

  • Can not insert/update data from table which is created from view

    Hi all
    I'm using Oracle database 11g
    I've created table from view as the following command:
    Create table table_new as select * from View_Old
    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
    Anybody tell me, what's happend? cause?
    Thankyou
    thiensu
    Edited by: user8248216 on May 5, 2011 8:54 PM
    Edited by: user8248216 on May 5, 2011 8:55 PM

    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK?

  • I cannot update my iPad and notes it cannot be updated due to unknown error (6). I have not yet updated my Macbook to Yosemite (which I do not intend to do so yet) so would this be the problem and if so, how can I update the iPad?

    I cannot update my iPad and notes it cannot be updated due to unknown error (6). I have not yet updated my Macbook to Yosemite (which I do not intend to do so yet) so would this be the problem and if so, how can I update the iPad?
    Thanks,
    glhiker

    Hi glhiker,
    I understand that you may be having some issues with your ability to update your iPad. Here is an article that references your error code and can help you take some steps to resolve it:
    Resolve iOS update and restore errors - Apple Support
    http://support.apple.com/en-us/TS3694
    Check your security software
    Related errors: 2, 4, 6, 9, 1000, 1611, 9006. Sometimes security software can prevent your device from communicating with either the Apple update server or with your device.
    Check your security software and settings to make sure that they aren't preventing a connection to the Apple servers.
    Thanks for coming to the Apple Support Communities!
    Regards,
    Braden

  • HT1414 i have the 1st iPad. Can it be updated to iOS 6.0.1?  If not how to fix-when on the internet sometimes it will just stop and go to the apps screen.

    i have the 1st iPad. Can it be updated to iOS 6.0.1?  If not how to fix-when on the internet sometimes it will just stop and go to the apps screen.

    svargaswp wrote:
    i have the 1st iPad. Can it be updated to iOS 6.0.1?  ...
    No.
    iOS 5.1.1 is the lastest for the iPad 1.
    svargaswp wrote:
    ... how to fix-when on the internet sometimes it will just stop and go to the apps screen.
    Try This...
    Close All Open Apps...  Sign Out of your Account... Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430
    Note:
    Also consider Deleting any Apps you have Purchased / Downloaded but you now never use..
    If necessary...
    Connect to iTunes on the computer you usually Sync with and “ Restore “...
    http://support.apple.com/kb/HT1414

  • HT4623 While in Japan on a trip, I updated my iPhone to iOS6.  Now, when I try to update my apps, I'm told that my account is not good in the Japan store I must switch to the USA store.  How do I do that so I can download and update apps at home in the US

    While in Japan on a trip, I updated my iPhone to iOS6.  Now, when I try to update my apps, I'm told that my account is not good in the Japan store I must switch to the USA store.  How do I do that so I can download and update apps at home in the USA?

    Your Apple ID is tied to the US store. Log out of the store, then trying logging back in.

  • Help I am trying to update my card info and the submit button on the site is not working

    Help I am trying to update my card info and the submit button on the site is not working

    What does the message say exactly? Are you sure it's not telling you the phone has no more space?

  • Access is not inserting, updating or deleting records in my database table on the server

    I am having a problem with an application I developed using Dreamweaver 8 and Access 2000 several years ago which is no longer working correctly. The problem is that Access is not inserting, updating or deleting records in my database table on the server but is reflected in changes to my Web site. I used the Dreamweaver server behaviors: insert record, update record and delete record to make the changes to my Access table on the server. My Access table on the server shows all of the records I inserted or updated in the past, but not any of the newly inserted on updated records.
    does any one have any ideas as to what my problem is?
    Jim

    No, that has nothing to do with your problem. Let's make sure I understand the symptoms.
    1) Your site is online at a remote host.
    2) You use a dynamic page in your online site to update a database record (insert, delete, or update)
    3) The update then appears correctly on your dynamic content page.
    4) You download the mdb and it appears to not have any of the upates you just made.
    Please correct any of these statements if they are wrong.
    If the above is correct, then you must be looking at a cached mdb, or the mdb you are looking at is in the wrong location. Do this: search your entire drive for copies of the mdb, including in the Windows temp directories which is likely where the cached copy is located. Delete any extra copies and download again.

  • How can perform insert /update /delete in one single mapping.

    Hi,
    I want to is there any logic by which we can create 2-3 pipeline in a mappings like pipelines will work for insert / update /delete or storing soem rejected data according to conditional flag.
    I tried it in a mapping but problem is that when target load order is like ins then upd then delete/reject . if new rec will come then control will pass through ins target . but if rec needs to update or delete then again control is going to ins target not update / delete target.
    We have already given the all conditional flags in filter after lookup and before target .
    all possibilities we checked but didnt got success.
    last option is separate the mappings for insert / update/delete.....etc.
    Is there any solution for this type of problem.
    reply plz if any body have solutions.
    ---Umesh

    Hi Umesh,
    I understand from your query that you want to load target with insert, update and delete rows after runnng the mappping...
    If you are looking for the same then you can use one of the Oracle fetures Oracle Streams: Change Data Capture.
    the Url is:
    http://www.oracle.com/technology/products/bi/db/10g/pdf/twp_cdc_cookbook_0206.pdf
    If any other help required do reply.
    Regards
    Tarang Jain

  • When I try to update my phone to ios 7 it says i need to update my itunes to 11.0.5, when i check my current version in help menu under check for updates it says I have the current 11.0.5 version.

    When I try to update my phone to ios 7 it says i need to update my itunes to 11.0.5, when i check my current version in help menu under check for updates it says I have the current 11.0.5 version. Even the downloader for the update doesnt show that i need to update.Help plzz????

    There is some kind of error. The new version of iTunes is 11.1, which although is not available via updates, it can be downloaded from the Apple website here:
    http://www.apple.com/itunes/download/
    After updating iTunes to the newest version you should be able to update your iOS
    EDIT: I just did that and it works

  • Error message: can't install update, firefox is already running, but it is not

    second request
    an auto update failed a few days ago and now everytime I open FF I get an error message that says can't install update, firefox is already running, but it is not!
    the parent.lock file is not open when FF is closed
    in addition to this message, a box opens asking looking for a file
    Help!

    hi
    I had the same problem (update failed for normal user, update worked for administrator, but then normal user still got asked about installing the update even though it was already done).
    Following the advice on http://kb.mozillazine.org/Software_update#Software_Update_not_working_properly worked for me, in particular to remove the update-related xml files.
    good luck
    kris

  • Why can't I update my ipod touch to the iOS 4.3?

    Why can't I update my ipod touch to the iOS 4.3?
    I try to update my ipod touch 4th gen. to the new iOS 4.3 software and the thing loads and after the 7-8 minutes or so, when it says "processing file" a pop up says that the network connection has timed out, and to check my network settings. I've tried several different times and get the same result. My wi-fi is working with all three bars and my computer is also connected to the internet. I've tried restoring it but it says I have to get the new software and then I get the same result( this time ipod not restored).... What's going on with my ipod? Anyone help?

    I AM NOT RESPONSIBLE IF ANYTHING GOES WRONG. THIS IS AT YOUR OWN RISK.
    Hi,
    Have you tried to see if you have the newest version of iTunes? Also, it may help if you try the following steps.
    Download iOS from a third-party website (i reccomend http://whited00r.com/) (as this is a full operating system, it is a big download and may take time on a slow internet connection)
    Unzip the file.
    After unzipping, you should now have a .ipsw file.
    Open iTunes
    Connect your device and make sure you take a back-up of it first (if you don't all your data will be erased)
    Now, while pressing the Restore button, hold down the Alt key (for Mac) or the Shift key (for Windows).
    You should now have a window open asking you to choose a file.
    Choose the file you just downloaded from whited00r.com
    Press OK
    It should start replacing your current OS to the new one.
    When this finishes, your device will restart
    Click restore from (whatever your old device was called)
    It will put back all your apps and information
    I AM NOT RESPONSIBLE IF ANYTHING GOES WRONG. THIS IS AT YOUR OWN RISK.

  • How can i check if the database contains the rows stated or not?

    hi there..
    i hav a problem here. I need to check the database if it contains the row of the attribute. If it doesnt not hav the row, i would then insert a new row into it, or else, i would only update the attribute. I have encountered a null pointer error and i've been trying to resolve it but i cant solve it. Here's my code..
    "i" is the attribute i wan to check if it exist in the database.
    "id" is the attribute i wan to check, from my JSP
    String m = null;
    String sql11 = "SELECT i from database WHERE i ='" + i+ "'";
    System.out.println(sql11);
    try {
    db = new Database();
    rs = db.readRequest(sql11);
    if (rs != null && rs.next()) {
    U u= new U();
    u.setU(rs.getString("i"));
    m = u.getU(); ==> this is the line tat's givin my null pointer
    System.out.println(m);
    db.close();
    } catch (SQLException se) {
    se.printStackTrace();
    throw (new UserException("Unable to retrieve from Database!"));
    } catch (Exception e) {
    e.printStackTrace();
    throw (new UserException("Unknow error encountered!"));
    if (m.equals(id)){
    //performs the updating of database
    else if (m_userID.equals("nil")){
    // performs the inserting of new row in the database
    }*/

    And what does getU() do?

  • How can I get a stripped screw out of the bottom of my iPhone?? I need help, How can I get a stripped screw out of the bottom of my iPhone?? I need help

    How can I get a stripped screw out of the bottom of my iPhone?? I need help, How can I get a stripped screw out of the bottom of my iPhone?? I need help

    Try asking at ifixit.com. The iPhone is not considered user servicable. You're not going to get much help on an Apple sponsored forum.

  • Help I bought iPhone and updated it asks Apple ID and I do not remember him help

    help I bought iPhone and updated it asks Apple ID and I do not remember him help

    Welcome to the Apple community.
    Unfortunately, you cannot do very much with your phone unless you get assistance from the previous owner, they should either provide you with the password to unlock it or remove their account from the phone entirely remotely through iCloud.com > Find My Phone.

  • I have a new PC. Old version of Acrobat can't be updated. I want to purchase Adobe Acrobat, not rent it! Where do I find that option?

    I have a new PC. Old version of Acrobat can't be updated. I want to purchase Adobe Acrobat, not rent it! Where do I find that option?
    I posted the question above about 45 minutes to one hour ago never saw it come up on the list. Trying again...
    Why can't I just contact Adobe directly? (My previous question is more important at the moment)

    Hi Matt,
    You can purchase Acrobat from the below mentioned URL.
    https://www.adobe.com/products/acrobat/pricing.html
    Thanks,
    Vikrantt Singh

Maybe you are looking for

  • Touch or Express for Galaxy S5

    Waht is the difference between Photoshop Touch and Photoshop Express for Android? I have a Samsung Gallaxy S5 large phone. Which one should I buy?

  • Query to pull duplicates in last 15 days

    I have a table with Account and Trans_date columns. I am trying to write a query to pull the accounts that are present today and also present in the last 15 days. [SQL] select distinct  a.* from     select             SFD.ACCOUNT,             SFD.TRA

  • Develop XML Service for Cisco UCM

    Hi all,      we are looking for guides in order to develop ad hoc XML Service for IP Phone in Cisco UCM (7.x and 8.x). One of our biggest clients has an internal team of XML developers and asked us what kind of services are possible to add, such as a

  • What is an accessorize test

    what is an accessorize test

  • RoboHelp Server 8 - roboapi.asp & robo.dll redirect

    We are currently using RoboHelp x5 and have upgraded to RoboHelp 8.  We need all requests for roboapi.asp and robo.dll which were supported in X5 to redirect properly to work in RoboHelp Server 8. I have read a few posts that recommend adding the Rob