tags:

views:

80

answers:

1

I have a table in Oracle that stores files as byte arrays in a BLOB field. I want my client to be able to download the stored file in small chunks (as opposed to downloading the whole thing all at once) so I can display a progress bar.

How can I write an Oracle query that retrieves only part of the contents of a BLOB field? I imagine it would be something like this:

SELECT PARTOF(BLOBFIELD, 1000, 2000) AS CHUNK FROM tbl WHERE ID = 1

if I wanted to get 1000 bytes from BLOBFIELD starting at byte 2000.

As a secondary question, are there any performance issues with this? If Oracle has to load the entire BLOB field into memory in order to return part of it, then this wouldn't be a very good idea.

+3  A: 

Can you use DBMS_LOB.READ (lob_loc, amount, offset, buffer)?

Tony Andrews
`DBMS_LOB.SUBSTR` is what I actually need, but I found it in your link, so you get the check. Thanks.
MusiGenesis