Access the Blob of Table data and save to file local system

I have a table that has a blob column in which most of the regular file types are downloaded and stored.

What is the best/better way to select/query this table and write all of the content of the BLOB in a local file system?

Using oracle 10.2.

Is it possible to sort the batch and save them on my local drive?

Any help is appreciated.

Thank you.

Try to reset the l_pos to 1 for each iteration in your loop of file name:

create or replace procedure save_to_file_third
is
 l_file      utl_file.file_type;
 l_buffer    raw(32767);
 l_amount    binary_integer := 32767;
 l_pos       integer := 1;
 l_blob      blob;
 l_blob_len  integer;
 myfile_name varchar2(250);

 cursor c1 is
  select id from security where file_name1 is not null;

begin

 for i in c1 loop
  -- Get LOB locator
  select file1, file_name1
    into l_blob, myfile_name
    from security
   where id = i.id;

  l_blob_len := dbms_lob.getlength(l_blob);
  l_pos      := 1;  --re-init l_pos var
  -- Open the destination file.
  l_file := utl_file.fopen('MY_FILES', myfile_name, 'wb', 32767);

  -- Read chunks of the BLOB and write them to the file
  -- until complete.
  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 loop;
exception
 when others then
  -- Close the file if something goes wrong.
  if utl_file.is_open(l_file) then
   utl_file.fclose(l_file);
  end if;
  raise;
end save_to_file_third;

Tags: Database

Similar Questions

  • Cannot access the server message coming up and cannot convert files

    Cannot access the server message coming up and can't convert the files. Works on my desktop, but not at home.

    ER

    Is it ExportPDF?

  • I want to disable the ability to go back and save your work before the expiration of time on the family safety settings

    My daughter uses the option to go back and save your work before closing down as a way open to passing the family safety settings. When she is about to be disconnected because of the time limit, she knows that three programs open with live data on them (like playing content in YouTube, chatting and playing an internet game all at the same time) he will come to the top and he the opportunity to go back and close its data. It completely negates the purpose of the limits of time. Because it doesn't then go back to the top and stop her. It falls just the problem completely. I don't know that this is just a gap in the family of security software. But thought I would ask to see if this option can be disabled, or if there is a way around it.

    If you find the Parental control in Windows help, he will guide you to articles online for the safety of these two parental controls & family.  There may be a solution in the event of children in one of these roads.

  • Access the same catalog of XP and 7

    Hello

    I added a second drive on which I have win7 RC running. Before destroying the soemthing I would ask some advice:

    Can I access the same catalog of XP and Win7?

    If you work on XP, everything is on the C: drive so that when you work on Win7 XP disk and threrfore catalogue is on drive D:\ win7 point of view. Will this be a problem? LR stores data of absolute paths in the catalog that would prevent me from doing this?

    Thanks for your suggestions.

    Franz

    McLion (+) wrote:

    Since I have the catalog and images on the XP C:, they would be seen on both D: of Win7 forcing me to update the location of the folder whenever I work another OS (bothway).

    I don't think that you still have to update the location of the folder, since the relative paths between the catalog and images will remain the same. I'm not sure, though - you should try.

  • I can access the internet, get on facebook and hotmail, but I can't play games on facebook and I can not open or respond to my emails

    I can access the internet, get on facebook and hotmail, but I can't pllay games on facebook and I can't open or respond to my e - but, anyone know wats up?

    Hi Danny

    It is a problem on Facebook. Here are links where you can get help.

    Facebook Help Center | Facebook: http://www.facebook.com/help/

    Facebook Support Forums: http://www.thefacebookforum.net/forum

    Concerning

  • What woulld be the easiest way to record and save everything that is stored on the computer.

    I am a newbie and the computer is an hp with vista windoows. My question, what woulld be the easiest way to record and save everything that is stored on the computer. Thanks in advance

    I am a newbie and the computer is an hp with vista windoows. My question, what woulld be the easiest way to record and save everything that is stored on the computer. Thanks in advance

    You can read this article on the backup that I wrote: 'Return to top your computer regularly and reliable' to http://www.computorcompanion.com/LPMArticle.asp?ID=314

  • Personalized Save: I would change where the first navigatges window me and in a file in my documents.

    When I click to save an image from the internet save them menu appears which navigates me the 'My pictures' folders on my pc.  I want to change where the first navigatges window me and in a file in my documents.

    When I click to save an image from the internet save them menu appears which navigates me the 'My pictures' folders on my pc.  I want to change where the first navigatges window me and in a file in my documents.

    I could be off in a way... but from what I've observed, the system remembers the LAST location you saved anything in.
    If it was the pictures folder, then it goes straight to the photos.
    You can use the Browse button.

    t-4-2

  • I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    Mr President.

    I create a form based on two tables that have sequences also. When I create insert only row is inserted in the fields in table first and second fields of the table are empty. Why?

    formdoubletables.png

    the page source is

    <?xml version='1.0' encoding='UTF-8'?>
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
                    xmlns:f="http://java.sun.com/jsf/core">
      <af:panelFormLayout id="pfl1">
        <af:group id="Group">
          <af:inputText value="#{bindings.VoucherId.inputValue}" label="#{bindings.VoucherId.hints.label}"
                        required="#{bindings.VoucherId.hints.mandatory}" columns="#{bindings.VoucherId.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId.hints.precision}"
                        shortDesc="#{bindings.VoucherId.hints.tooltip}" id="it1">
            <f:validator binding="#{bindings.VoucherId.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId.format}"/>
          </af:inputText>
          <af:inputDate value="#{bindings.VoucherDate.inputValue}" label="#{bindings.VoucherDate.hints.label}"
                        required="#{bindings.VoucherDate.hints.mandatory}"
                        columns="#{bindings.VoucherDate.hints.displayWidth}"
                        shortDesc="#{bindings.VoucherDate.hints.tooltip}" id="id1">
            <f:validator binding="#{bindings.VoucherDate.validator}"/>
            <af:convertDateTime pattern="#{bindings.VoucherDate.format}"/>
          </af:inputDate>
          <af:inputText value="#{bindings.Credit.inputValue}" label="#{bindings.Credit.hints.label}"
                        required="#{bindings.Credit.hints.mandatory}" columns="#{bindings.Credit.hints.displayWidth}"
                        maximumLength="#{bindings.Credit.hints.precision}" shortDesc="#{bindings.Credit.hints.tooltip}"
                        id="it2">
            <f:validator binding="#{bindings.Credit.validator}"/>
          </af:inputText>
        </af:group>
        <af:group id="g1">
          <af:inputText value="#{bindings.Lineitem.inputValue}" label="#{bindings.Lineitem.hints.label}"
                        required="#{bindings.Lineitem.hints.mandatory}" columns="#{bindings.Lineitem.hints.displayWidth}"
                        maximumLength="#{bindings.Lineitem.hints.precision}" shortDesc="#{bindings.Lineitem.hints.tooltip}"
                        id="it3">
            <f:validator binding="#{bindings.Lineitem.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Lineitem.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.VoucherId1.inputValue}" label="#{bindings.VoucherId1.hints.label}"
                        required="#{bindings.VoucherId1.hints.mandatory}"
                        columns="#{bindings.VoucherId1.hints.displayWidth}"
                        maximumLength="#{bindings.VoucherId1.hints.precision}"
                        shortDesc="#{bindings.VoucherId1.hints.tooltip}" id="it4">
            <f:validator binding="#{bindings.VoucherId1.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.VoucherId1.format}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Debit.inputValue}" label="#{bindings.Debit.hints.label}"
                        required="#{bindings.Debit.hints.mandatory}" columns="#{bindings.Debit.hints.displayWidth}"
                        maximumLength="#{bindings.Debit.hints.precision}" shortDesc="#{bindings.Debit.hints.tooltip}"
                        id="it5">
            <f:validator binding="#{bindings.Debit.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Credit1.inputValue}" label="#{bindings.Credit1.hints.label}"
                        required="#{bindings.Credit1.hints.mandatory}" columns="#{bindings.Credit1.hints.displayWidth}"
                        maximumLength="#{bindings.Credit1.hints.precision}" shortDesc="#{bindings.Credit1.hints.tooltip}"
                        id="it6">
            <f:validator binding="#{bindings.Credit1.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Particulars.inputValue}" label="#{bindings.Particulars.hints.label}"
                        required="#{bindings.Particulars.hints.mandatory}"
                        columns="#{bindings.Particulars.hints.displayWidth}"
                        maximumLength="#{bindings.Particulars.hints.precision}"
                        shortDesc="#{bindings.Particulars.hints.tooltip}" id="it7">
            <f:validator binding="#{bindings.Particulars.validator}"/>
          </af:inputText>
          <af:inputText value="#{bindings.Amount.inputValue}" label="#{bindings.Amount.hints.label}"
                        required="#{bindings.Amount.hints.mandatory}" columns="#{bindings.Amount.hints.displayWidth}"
                        maximumLength="#{bindings.Amount.hints.precision}" shortDesc="#{bindings.Amount.hints.tooltip}"
                        id="it8">
            <f:validator binding="#{bindings.Amount.validator}"/>
            <af:convertNumber groupingUsed="false" pattern="#{bindings.Amount.format}"/>
          </af:inputText>
        </af:group>
        <f:facet name="footer">
          <af:button text="Submit" id="b1"/>
          <af:button actionListener="#{bindings.CreateInsert.execute}" text="CreateInsert"
                     disabled="#{!bindings.CreateInsert.enabled}" id="b2"/>     
          <af:button actionListener="#{bindings.Commit.execute}" text="Commit" disabled="#{!bindings.Commit.enabled}"
                     id="b3"/>
          <af:button actionListener="#{bindings.Rollback.execute}" text="Rollback" disabled="#{!bindings.Rollback.enabled}"
                     immediate="true" id="b4">
            <af:resetActionListener/>
          </af:button>
        </f:facet>
      </af:panelFormLayout>
    </ui:composition>
    
    
    
    

    Concerning

    Go to your VO Wizard, select the tab of the entity and to check if both the EO is editable or not.

    See you soon

    AJ

  • What opening of database Service of Cloud Computing console receiveing "the user role cannot access the Cloud database Service" message and see no service. Why?

    What opening of database Service of Cloud Computing console receiveing "the user role cannot access the Cloud database Service" message and see no service. Why?

    Thank you in advance.

    Try now

  • Find the difference between two date and time

    Hi friends,

    I wanted to find the difference between two date and time, but my qury is slightest error "invalid number."

    select sql_step_num,proc_name,run_seqno,start_date,end_date,(to_char(start_date,'HH24-MI-SS') - to_char(end_date,'HH24-MI-SS') ) as ed  
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate) 
    order by sql_step_num;

    You try to get the feel between two char strings.
    And more difference between two dates gives a NUMBER of days.
    Try this:

    select sql_step_num,proc_name,run_seqno,start_date,end_date,numtodsinterval(end_date-start_date,'DAY') as ed
    from eval.EVAL_RUNTIME_DETAILS
    where trunc(start_date) = trunc(sysdate)
    order by sql_step_num;
    
  • Cannot edit and save a file shared between 2 computers in a network after installing Windows6. 1-KB917607-x 64.msu.

    Original title:

    My husband has a computer that is running Windows XP with WinHlp32.exe.  I have a new computer with Windows 7 with 64 bit.  We are interconnected.  I could access its programs, edit files and save them to his system.  In particular, Overture 3.1 for musical notation.  Today, I need help in this program.  There was no help.  He told me to load Windows6. 1-KB917607-x 64.msu fix.  After it's download, I could access the help files.  The file was saved to my computer 32-bit of husbands and now he cannot open this file.  We must be able to modify each and other files and save to the original source.  Help, please!  If there is not a solution to this problem, can I reverse the installation of the said .msu file and live without help on 32-bit programs?  Told by people we bought the new machine that he would have no problems being networked with someone that is running Windows XP.

    Dizzy Daisy

    Hello

    The question is specific to this file, or occurs with all the files?

    Try these methods and check.

    Method 1:

    Do a system restore and check.

    System restore

    Method 2:

    Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    Back up the registry

    a. click Start, type regedit and press enter.

    b. navigate to the following location.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WinHelp

    c. Add a DWORD value that is named AllowIntranetAccess to this subkey and set the value to 1.

    Reference:

    I can't open the help that was created in Windows Help format (WinHlp32.exe)

  • How to download and save a file mp3 songs or movies

    How to download and save a file mp3 songs or movies

    Hello

    a lot of songs and movies have taken your ability to simply download the site now. If you want to search for the download of instructions on individual Web sites. (Amazon.com example) However, the best way to download is the right click on a pic/song/video/file and select Save.

    calculation of the happy,

    B Eddie

  • How I've spread my video into several parts and save each file under different names?

    How I've spread my video into several parts and save each file under different names?

    You are going to need a video editing package to do this, you can not cut just to the top of the video into segments at the file level.

    With an editor, you can then crop the video into segments

  • Download and save a file in JDeveloper - iOS particularly

    I'm developing an application native simple iOS, using the Oracle JDeveloper .

    How can I download a file, giving a URL and store it in the storage of iOS? For example, in Android, the code to access the storage is Environment.getExternalStorageDirectory() and I can use it to download a file, a HttpURLConnection and the requestMode to GET .

    Once the JDeveloper allows you to deploy applications for Android and iOS devices, how can I make these calls? What are java classes that allow me to download and store a file? I found no information in the Oracle documentation.

    Thank you

    Will be.

    The model of Mobile ADF is provided by Oracle ADF. Download a file from a URL as in the ADF, which several references are available.

    JDeveloper, Oracle ADF & amp; Java: Download the file from the url using Oracle ADF & Java-Download Manager

    Download the file from the URL using ADF (emergency assistance required)

    ADF Code Bits: Bit #19 - downloading a file

    Oracle ADF: Download the file in ADF

  • Can I convert an entire folder at a time or I need to convert and save each file in this folder one at a time and then download on my cloud to see my phone as well?

    Can I convert an entire folder at a time or I need to convert and save each file in this folder one at a time and then download on my cloud to see my phone as well?

    Hi kezleyp1982,

    You can convert files of different format in a folder as PDF by choosing "file > create > create multiple files"

    Once converted to PDF format, you can connect to "http://cloud.acrobat.com/" using your Adobe ID credentials and then download all the files to Document cloud at a time (press Ctrl + A to select).

    Hope that helps.

    Kind regards

    Ana Maria

Maybe you are looking for

  • two java plugins appear in the modules

    Page modules two watch java plug-ins.Java (TM) plug-in 11.11.2 next generation Java plug-in for browsers Mozilla 11.11.2Java (TM) plug-in 11.5.2 next generation Java plug-in for browsers Mozilla 11.5.2 My plugins directory (~/.mozilla/plugins) contai

  • Can't send or receive messages on behalf of Cox

    original title: still no joy I can't fix that even with all the security settings and removed filter... Can't send or receive messages on behalf of Cox (brevlantz).

  • The event log does not start error 31: a device attached to the system is not functioning

    I can't get the service to start on my winxp sp3 pc event log. I have tried everything I know: Running sfc/scannow Reset permissions Search for malware and viruses Rebuild the WMI Create a new account Nothing seems to work, I think that this is relat

  • life time

    HelloHere's some of my file of peoplesoft sqltrace:I wonder which of the two motions is a matter of concern:PSAPPSRV.658161-55403 15.49.420.000 Cur #1.MYSYSTEM RC = 0, hard = 0.000 COM Stmt = SELECT PTCUSTOMFORMAT FROM PSUSEROBJTYPE WHERE MENUNAME =:

  • Palm Desktop software showing only option Media

    I have a Z22 and a PC running Vista.  I used the Palm desktop for a couple of years without any problems. The only change I made recently to my PC is to install Firefox. The next time I open the Palm Desktop, everything like my calendar, notes, etc.