Tuesday, January 19, 2016

Writing a blob into a file with PL/SQL with a single line of code.

I have updated my blob_wrapper so that it can write a blob with a single line:

blob_wrapper.to_file('c:\temp\abc.txt', my_blob);

This creates the file c:\temp\abc.txt and fills it with the content of my_blob

A varchar2 can be converted into a blob and then written into the file like so

begin blob_wrapper.to_file( 'c:\temp\two_params.txt', utl_raw.cast_to_raw('foo bar baz') ); end; /

Programming PL/SQL almost makes fun again.

No comments:

Post a Comment