Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: CLOB length problem
"Charles Griswold" <cgriswold_at_attbi.com> wrote in message news:cZwCa.33288$M01.9627_at_sccrnsc02...
> I have a JDBC-Oracle app that reads and writes XML streams to CLOBs. For
> both reading and writing, I use a preparedstatement to get a Clob object and
> use either a stream reader or writer to access the xml data. In the
> situation where I shorten the XML stream and update the CLOB, the next time
> I read in the XML stream it has data from a previous update on the end of
> the XML stream. I was expecting the CLOB to remember the length of the last
> time it was written
> Has anyone had a similar experience? Do you have to manage the length
> yourself?
If you think a bit about it, it will be clear that this is expected behavior. The same will happen if you will use a file stream in this fashion:
You will end up with 1000-byte file with its first half overwritten by your update, not with 500-byte file.
To *replace* a CLOB, you either need to trim it to zero length and then write it, or create a new empty CLOB, write it and then update the table with it.
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer.Received on Mon Jun 02 2003 - 00:45:18 CDT
![]() |
![]() |