Advertisement

10.29.2007 at 02:36AM PDT, ID: 22923907
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Gotcha when updating LOBs via OCCI

Asked by davidhq in Oracle Database

Tags: , ,

hi!

I discovered that when I try to update a blob with a new blob that is shorter in size, the data from the first blob is left behind.

Example might help:
- there is a 100k blob in a column
- I update it with another 200k blob -> everything is ok
- I update that with a new 50k blob -> now the size stays at 200k with first 50k from the new blob and the rest from the previous one

I really didn't expect that behaviour.. am I lacking a broader understanding how OCCI really works?

Anyway.. I managed to figure a "dirty workaround".. It seems to work, but I don't like it and besides I'm not sure if there is no "orphaned data" left around in the database.


Current solution (suppose LOB_COL contains a 200k binary lob):

- get a Blob from the database ("SELECT LOB_COL FROM TABLE WHERE ID=1 FOR UPDATE"; .....
Blob blob = rset1->getBlob (2);)

- Set blob object to empty (blob.setEmpty();) and UPDATE it back ("UPDATE TABLE SET LOB_COL=:val1 WHERE ID=1;"

- After that run EMPTY_BLOB() function.. if not, I get LOB Locator errors.. so "UPDATE TABLE SET LOB_COL=EMPTY_BLOB() WHERE ID=1"

- Get Blob object from the DB again (same as the first step)

- Populate the blob (from a 50k file) (blob.getStream() and stream->writeBuffer())

- Update it again


Please help me understand why this happened and suggest the right way to make it work.. or at least tell me that my solution is good enough after all.. (or it even has to be done that way). Thank you very much!

DavidStart Free Trial
 
 
[+][-]10.29.2007 at 08:30AM PDT, ID: 20170290

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: examples, lobs, occi
Sign Up Now!
Solution Provided By: schwertner
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628