I have filled a blob variable using
Var test blob
Begin select blob_column into :test from test_table where rownum = 1; end;
/
Now I like to write this Blob to a file.
I have seen the examples:
script
// issue the sql
var ret = util.executeReturnList('select id,file_name,file_content from images',null);
// loop the results
for (i = 0; i < ret.length; i++) {
// debug is nice
ctx.write( ret[i].ID + "\t" + ret[i].FILE_NAME+ "\n");
// get the blob stream
var blobStream = ret[i].FILE_CONTENT.getBinaryStream(1);
// get the path/file handle to write to
var path = java.nio.file.FileSystems.getDefault().getPath(ret[i].FILE_NAME);
// dump the file stream to the file
java.nio.file.Files.copy(blobStream,path);
}
/
and
binds = ctx.getVarMap();
numVar = binds.get('NUM_VAR');
value = numVar.getValue();
ctx.write("num_var = " + value + "\n");
Both examples are working fine.
But how can I write the Blob value which I get by:
var blobVar = ctx.getVarMap().get("TEST").getValue();
to a file.