BLOBDUMP
BLOBDUMP blob_id filename
This command allows you to copy a BLOB
from the database into an external file.It is the responsibility of the user to ensure that the correct file type is used — don’t call an image file something.txt
when it should be a jpeg for example.
Blobdump
requires two parameters, a blob id and a filename.The latter is simple, but the former is more convoluted.You pass the blob id as a pair of hexadecimal numbers, separated by a colon.The first number is the relation id number for the table in question, and the second is a sequential number within the database.You will see this pair of numbers when you select any BLOB column’s data from a table — it is displayed above the BLOB
contents, assuming that the display of BLOB
s is turned on.See the [isql-set-blobdisplay] command below for details.
SQL> set blobdisplay off; SQL> select proj_id, proj_desc CON> from project CON> where proj_id = 'MKTPR'; PROJ_ID PROJ_DESC ======= ================= MKTPR 85:10 SQL> blobdump 85:10 project.jpg; SQL> blobdump 85:10 project.txt;
The blob id required in the above example is the '85:10' value.You will notice that I have dumped this BLOB to both a jpeg and a text file.Isql
gave no errors for the fact that I attempted to dump the BLOB
to a jpeg file when the BLOB
in question is text.Attempting to open the jpeg file with any image viewers will, however, result in an error.The text file opens happily in any of the assorted text viewers or editors installed on the system.