Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6028623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:46:02+00:00 2026-05-23T04:46:02+00:00

I have a database which has a number of files stored in a BLOB

  • 0

I have a database which has a number of files stored in a BLOB field.

How can I extract & save the original files? There are many different file types – doc, pdf, xls, etc. The table has the extension in one col, and the original file name in another. There may be multiple files with the same file name, too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:46:02+00:00Added an answer on May 23, 2026 at 4:46 am

    You can use the UTL_FILE package to do this in version 9i onwards

    something like this:

    DECLARE
      l_file      UTL_FILE.FILE_TYPE;
      l_buffer    RAW(32767);
      l_amount    BINARY_INTEGER := 32767;
      l_pos       NUMBER := 1;
      l_blob      BLOB;
      l_blob_len  NUMBER;
    BEGIN
    
      SELECT blobcol
      INTO   l_blob
      FROM   table
      WHERE  rownum = 1;
    
      l_blob_len := DBMS_LOB.getlength(l_blob);
    
      -- Open the destination file.
      l_file := UTL_FILE.fopen(<location>,<filename>,'wb', 32767);
    
      WHILE l_pos < l_blob_len LOOP
        DBMS_LOB.read(l_blob, l_amount, l_pos, l_buffer);
        UTL_FILE.put_raw(l_file, l_buffer, TRUE);
        l_pos := l_pos + l_amount;
      END LOOP;
    
      -- Close the file.
      UTL_FILE.fclose(l_file);
    
    END;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database which has a NOT NULL constraint on a field, and
I have a setting stored in database which has a value .jpg|.gif|.png . I
I have a database with files which can be searched, browsed and have multiple
I have a database which has a table recording when a vehicle was last
I have a SQL Server database which has grown to more than 15GB in
i have come across a mysql database which has dates entered in a varchar
I have a table (session) in a database which has almost 72,000 rows. I
I have a table in SQLite database of Android which has a column RANK
We have a Oracle 9i database and OrderDetails table which has a column to
I have a table which has essentially boolean values in a legacy database. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.