When overwritting CLOB longer previous value still remains

Hi,
I have a problem with updating CLOB's. Below is how I write them:
String selectStatement = "select description from modules where " +
"system = ? and version = ? and module = ? for update";
PreparedStatement selStmt = con.prepareStatement(selectStatement);
selStmt.setString(1, system);
selStmt.setString(2, version);
selStmt.setString(3, module);
ResultSet rset = selStmt.executeQuery();
ResultSetInPool rpool = (ResultSetInPool)rset;
if (rpool.next()) {
desclob = (CLOB)((OracleResultSet)rpool.getUnderlyingResultSet()).getCLOB(1);
// Write character stream (description) to CLOB variable
writer = ((CLOB)desclob).getCharacterOutputStream();
writer.write(description.toCharArray());
writer.flush();
} else {
throw new NoSuchEntityException("Row does not exist");
The problem is that when there is a value already written which is longer then new one, part of the old value (which has not been overwriten) still remains in the database. Is that normal behavior? Is there any way how to address this problem better/faster then updating row with EMPTY_CLOB() and writting string again?
Thanks for response in advance,
RAF

Hi Rafal,
If you are using Oracle9i JDBC Drivers, then use the
oracle.sql.CLOB.trim(long offset) method to clear the contents of the CLOB.
like ,
// clear the contents of clob
clob.trim(0);
else If you are using JDK 1.4 , use java.sql.Clob.truncate(long offset)
clob.truncate(0);
then start streaming the new contents into the clob.
I guess its the normal behaviour of CLOB.
Regards
Elango.

Similar Messages

  • BUG? ORA-01461 in Unit Tester when saving a long Dynamic Value Query

    I get an ORA-01461 "can bind a LONG value only for insert into a LONG column" error when saving a Test Implementation with a Dynamic Value Query whose length of the SQL statement is roughly 2,000 characters - I'm UNIONing ALL about 30 test case values together, but it seems to be choking on such a long SQL string for some reason....
    I am running version Early Adopter Release #2 (2.1.0.63), build MAIN-63.10.
    Thoughts?

    Confirmed.
    Bug 9119144: ORA-01461 IN UNIT TESTER WHEN SAVING A LONG DYNAMIC VALUE QUERY (OR OTHER CLOB)
    Brian Jeffries
    SQL Developer Team

  • Struts: checkbox's previous value remains after unselecting it

    hi
    I have a checkbox in a JSP in struts environment:
    <html:checkbox property="conversionOption"/>now in struts-config, the dynaactionform is :
    <form-bean name="QuoteDetailsBean" type="org.apache.struts.validator.DynaValidatorActionForm">
                                      <form-property name="conversionOption" type="java.lang.String"/>
                  </form-bean>now if the checkbox is not clicked, and in the action class I do:
    String s = (String)formbean.get("conversionOption");s is null.
    Now when i check(select) the check box, and click on submit the String s is 'on'. After this if I click on 'back' button and then uncheck the checkbox and click submit., the String is still 'on'. I expect it to be null or something other than 'on'.
    It seems struts does not set conversionOption property if the checkbox for that property is not selected. so the previous value remains.
    how do I overcome this?
    I tried by changing :
    <form-property name="conversionOption" type="java.lang.String"/>
    to
    <form-property name="conversionOption" type="java.lang.String[]"/>
    but it did not help. changing to String[] will help if i have musltiple checkboxes for the same property. but my form has only one checkbox.
    can anybody please help me?
    Tanveer

    I think u got this wrong.
    In struts if the chechbox is unchecked the value is not set to anything and thus its unchecked and nothing is sent to servlet. If u checked and submitted the page then a value called "on" is set to the attribute that represents the checkbox in ur form. Now consider that u checked the checkbox and hit submit. come back and see that checkbox is checked. now uncheckit and hit submit. come back and see it unchecked. now hit back of IE "SHOULD IT BE CHECKED??" ANSWER IS NO. "BACK" button of IE or NS is not equivalant to sending a request? thus in the previous request even if has the property corresponding to the check box is availabe and is "on" and u can see that in the URL(its just a cache ant not exactly the request) the check box will not be checked and viceversa.
    clear

  • I'm in cycle mode, and 'merge' is clicked in preferences. However, when I record, my previous track data keeps getting overwritten. Does anyone know what I'm doing wrong. Interestingly, I can still see the data in the region.

    I'm in cycle mode, and 'merge' is clicked in preferences. However, when I record, my previous track data keeps getting overwritten. Does anyone know what I'm doing wrong. Interestingly, I can still see the data in the region.

    jamestait wrote:
    when I record, my previous track data keeps getting overwritten.
    since you didn't specify, are you recording in a single take?
    http://www.bulletsandbones.com/GB/GBFAQ.html#multipassrecording
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • I turned off my phone and when I turned it back on, all my apps were deleted. I tried to reinstall my apps, but it wouldn't let me. My storage still remained the same even though, all my apps were deleted. How can I get my apps back?

    I turned off my phone and when I turned it back on, all my apps were deleted. I tried to reinstall my apps, but it wouldn't let me. My storage still remained the same even though, all my apps were deleted. How can I get my apps back?

    Hold the home and power button down until your phone restarts. If that doesn't work, backup and restore using iTunes.

  • I cant change the old icloud mail to a new one because i have lost my password , and when i changed it in ap-id page it still remains the same, nothing changes .

    cant change the old icloud mail to a new one because i have lost my password , and when i changed it in ap-id page it still remains the same, nothing changes .
    What do do ????

    You do not have to call US, but you need to call. Or else.
    Contact Apple for support and service - Apple Support

  • Cannot delete the Folder on the desktop after Mavericks update. when I try to delete it, it is asking for logon password, When I give the logon password, it plays a sound of moving to Trash, but the folder still remains on the desktop

    Cannot delete the Folder on the desktop after Mavericks update. when I try to delete it, it is asking for logon password, When I give the logon password, it plays a sound of moving to Trash, but the folder still remains on the desktop
    Please help

    It is a folder which I have created. Name is "SAP".
    I copied some of my office stuff and then deleted the contents inside the folder. But I couldnt delete the folder SAP.
    This is happening after the Mavericks update.

  • After deleting Calendar users, their subscriptions still remain, and the server crashes when accessing deleted calendars

    After deleting users from iPlanet Calendar Server(iCS), the users'
    subscriptions still remain. Then, if a user tries to unsubscribe
    from a deleted calendar, the server sometimes crashes, even though sufficient
    disk space and memory are available. When checking the HTTP log, the
    log shows that certain calendars don't exist.
    The solution to this problem is to back up the ics50gse.db
    file to another file with a different
    name, or remove the file from the db
    directory.
    <P>
    If you are upgrading your iCS, make sure the GSE database queue is empty
    before you perform the upgrade. To check the GSE database queue,
    you can use either of the following commands while the server is either
    running or stopped:
    <P>
    csschedule list
    <I>OR</I>
    csdb -v list
    <P>
    After issuing the command, if nothing is displayed, the GSE queue is empty, and
    you can proceed to step 3 below. However, if the queue does contain
    items, use the following steps to flush it:
    <P>
    <OL>
    <LI>Start the server if the server is in a <I>stopped</I> state.
    <P>
    <LI>Stop only the cshttpd
    daemon so that no new requests can
    come in.
    <P>
    Note: It should take only a few minutes for the GSE to handle any requests.
    Typically, the GSE queue will be empty.
    <P>
    <LI>Shut down iCS.
    <P>
    <LI>Rename the ics50gse.db
    file.
    <P>
    <LI>Restart the server.
    </OL>
    <P>
    If you have already upgraded the server and are experiencing the above
    mentioned problems, use the following steps:
    <P>
    <OL>
    <LI>Shut down iCS.
    <P>
    <LI>Rename the ics50gse.db
    file.
    <P>
    <LI>Restart the server.
    </OL>

    I forgot to mention that I've cleared out ~/Library/Caches/ for my test user, as well as deleted the iWeb .plist file.

  • In the last two months when I turn my iPhone horizontal the screen still remains vertical??? Can anyone share a tip to help me fix this ?

    I cannot figure out how to get my screen to turn horizontally when I turn the phone. It still remains vertical.

    I am pretty sure that using pre-paid SIM cards is not an officially supported feature, so you may have been automatically switched to an iPhone plan, which is the standard for all iPhone devices on AT&T/GSM carrier.

  • How do i deactivate all previous installments when i no longer have computer or computer not working

    how do i deactivate all previous installments when i no longer have computer or computer not working

    You need to contact support directly for activation/deactivation and other installation issues.
    To get help now click here for product support

  • In imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

    in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

    in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?

  • Calculating based on a previous value when initial column values differ from the rest

    Let me preface this by saying I am new to the BO world. I'm trying to build a report/chart that tracks incoming loads. The first supply on hand value is pulled from the database and each successive supply on hand is based on the previous row's values.
    In the supply arriving column below, the iniital value differs from the rest using the formula:
         =If [Row Number]=1 Then [First Supply Arriving] Else [Supply Arriving]
    The supply on hand uses the same idea, but is where I'm running into problems. The first column value should be [Supply On Hand], easy enough. Each successive column value needs to follow this equation:
         Previous([Supply On Hand] (this won't always be [Supply On Hand] though, only for the second row essentially - problem 1) + Previous([Supply Arriving] (same as problem 1, where this is first supple arriving for the second row and then supply arriving moving forward) - [Usage Rate]
    If someone could help me in getting the calculation to pull the previous values correctly without making a ton of variables, I'd greatly appreciate it. We just upgraded to 4.1

    Yes, the supply on hand and the supply arriving from the previous row need added together. The usage rate, which is a constant is then subtracted from that. The result is the on hand total for the next day.
    For example:
    Date
    On Hand
    Arriving
    Usage Rate
    9/9/2014
    100,000
    250,000
    100,000
    9/10/2014
    250,000
    1,000,000
    100,000
    9/11/2014
    1,150,000
    0
    100,000

  • Deleted Table in SQL and DBML still remained relation !!!!

    Hi Dear Experts
    I've faced the serious problem please help me :( !
    I've deleted a table from SQL database and also dbml and i created new table instead
    Also in Store Procedure the new table is used
    I've checked that the old table has completely removed
    but when in want to excecute the solution (the SP it tells me that previous relation (Foreignkey )
    is still remained ?!!!!!!) 
    ***THE OLD TABLE WAS IN RELATION WITH A TABLE IN SP BUT NOW IS IN RELATION WITH NEW TABLE*****
    Why this error occured even i've have removed the table?????
    Thanks a lot

    Error Message
    the insert statment Confilicted with foreign key constarint "FK_<tableName>_<oldtable>".the conflict occurred in database,table<old table>,column'x'
    thanks a lot
    Hi nasringh,
    Could you please check the relationship and the underlying records between foreign key table and primary key table? We must insert Data into the parent table which containing the Primary Key, before attempting to insert data into the child table containing
    the Foreign Key.
    For more detail information, please take a look at the following similar thread:
    http://stackoverflow.com/questions/2965837/insert-statement-conflicted-with-the-foreign-key-constraint
    http://www.codeproject.com/Questions/281774/The-INSERT-statement-conflicted-with-the-FOREIGN-K
    Regards,
    Elvis Long
    TechNet Community Support

  • Java.io.NotSerializableException when overwrite the JTable data into .txt

    hi everyone
    i had java.io.NotSerializableException: java.lang.reflect.Constructor error when overwrite the JTable data into .txt file.
    At the beginning, the code will be generate successfully and the jtable
    will be showing out with the data that been save in the studio1.txt
    previously,
    but after i edit the data at the JTable, and when i trying to click the
    save button, the error had been showing out and i cannot succeed to
    save the JTable with the latest data.
    After this error, the code can't be run again and i had to copy the studio1.txt again to let the code run 1 more time.
    I hope i can get any solution at here and this will be very useful for me.
    but i dunno how to attach my .txt file with this forum
    did anyone need the .txt file?
    the following is my suspect code
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String filename1 = "studio1.txt";
              try {
                  FileOutputStream fos = new FileOutputStream(new File(filename1));
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                   oos.writeObject(jTable2.getModel());
                   oos.flush();
                   oos.close();
                   fos.close();
              catch(IOException e) {
                   System.out.println("Problem creating table file: " + e);
                            e.printStackTrace();
                   return;
              System.out.println("JTable correctly saved to file " + filename1);
    }this is the reading code
    String filename1="studio1.txt";
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   TableModel model = (TableModel)ois.readObject();
                    jTable3.setModel(model);
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
              }Edited by: Taufulou on Jan 8, 2009 11:43 PM
    Edited by: Taufulou on Jan 8, 2009 11:44 PM
    Edited by: Taufulou on Jan 8, 2009 11:45 PM

    is this the code u mean?
    i had put this code inside it but the problem still remain the same
    if (jTable2.isEditing()) {
                jTable2.getCellEditor().stopCellEditing();
            }i had found a new thing that when i just double click the cell without change any data inside the table
    and click the button "Save". the same exception which is
    java.io.NotSerializableException: java.lang.reflect.Constructor
    will come out again.

  • All previously installed applications remain after "fresh" install of OS X 10.8.4

    Hey guys,
    So this may or may not be a problem.  The issue is that I was having some system screen flickering/freezing on my Macbook Pro (Early 2011) so I decided to reinstall 10.8.4 Mountain Lion to see if this would solve the issue.  Went through the procedure of creating a reinstall flash drive and proceeded.  Chose the drive containing my old OS (10.8.4) and installed.  Process took about 1:30 hours to download and install necessary files.  When the OS install is complete and the machine boots back up nothing has changed.  All previously installed applications remained and the machine home folder is still named for the previous owner? (bought on ebay)  Does Apple auto reset all previous settings through my AppleID?  Or did this OS re-install not complete correctly?  I need to FULLY wipe this machine and after going through the process I am not even sure if anything took place.  Any help would be appreciated.  Thanks
    -Andrew

    nogdog21 wrote:
    I am reading an article suggesting that I can use boot utility to format all drives if I boot into the recovery partition.  From there I can reinstall using the internet recovery.  Is this a wise move to avoid buying Snow Leopard?
    The Early 2011 Mac originally came with 10.6
    10.7 and 10.8 are paid upgrades tied to the previous owners AppleID, therefore you can't apply security updates to that previous owners copy as you don't have their AppleID and password.
    The object to go back to Snow Leopard 10.6 is so that when you upgrade to 10.8, it's yours and you can upgrade all your paid software and operating system through the AppStore concept.
    Later, if you need to erase and install 10.8 fresh, then yes, you use Internet Recovery or RecoveryHD as then your AppleID and password will work as intended and there is no need to use the 10.6 disks any longer, they can be sold if you wish as you don't have 10.6 on the machine anymore.

Maybe you are looking for

  • Why did apple switch to a different design other than the outer band dual antenna design in the iphone5 ?

    This is a subject i'm not to familiar with but i do know a little about antenna design. I was wondering what caused apple to switch to a different design (did they?). What research caused this change ? Thanks, David ps: was also wondering what the di

  • Badi for PO Trigger & PO Form Name-in ICH

    Hi Guru's           I need help from all, which Badi will trigger the Standard PO for Supplier View & watz the  Standard PO Name, where we can find that form .

  • Transaction iView - reload of content

    Hi Experts. A transaction iView (SAP GUI for HTML) displays a SAP transaction in the portal. But whenever I navigate to another portal content and then back to the SAP transaction iView the procedure starts again (connecting to R/3 and starting the S

  • Raising alert in BPM

    Hi Folks I have a scenario in which i have to merge three files  in BPm and generate an Idoc  MY BPM has >>>>3  recieve steps in a fork                                   1  transformation step                                   1 send Step            

  • Stored procedure scope: using sp from another database

    Good day, I hava a stored procedure named sp_emps (simple select from an employees table) in a database named Employees. I would like use this procedure in a another database named New_Employees. Is this possible, without creating / copying the sp to