Write binary files to HTTP response using Webtoolkit

We are using Webtoolkit to generate HTTP responses from stored procedures. This works fine for generating HTMLs.
However, the functions used for HTML generation ( htp.print , htp.prn ) support only plain text (they handle only VARCHARs).
How can we generate binary HTTP response (e.g. PDF/DOC files) ? What are the packages/functions which provide this functionality ?
Thanks,
Subodh

You can still use the built in Oracle procedure.
wpg_docload.download_file(v_blob);
Write Your procedure as follows:
1. Load the BLOB from a table or from disk (BFile) into a BLOB object.
2. Set your HTTP headers.
3. Send your HTTP response.
(some stuff omitted)
owa_util.mime_header(type_mime, FALSE);
htp.p('Content-Length: ' || v_size);
owa_util.http_header_close;
wpg_docload.download_file(v_blob);
Remember, you can use Oracle's owa_util package to set things or do it yourself manually. Also, you can substitute wpg_docload.download_file for your own code (using RAW) but your making it more complicated.

Similar Messages

  • Outbound RFC to file: Received HTTP response code 500

    hello:
    i am doing outbound rfc from ecc to other system using PI and I get the below error in the PI.
    I am on PI 7.0 and looked at the RFC destiantions in ECC and all look good.
    The registered program in TCP/IP RFC destination was tested and looks fine .
    I checked the SMICM in PI running at port 8000 and it looks file and also i checked the SXMB_ADM Interation configuration in PI which looks good too .
    Even the PI integration engine is restarted . i am sure its in PI and I am hoping its related to user in PI -adapter frame work user XIAFUSER?
    can you please let me know how to fix the below issue ..
    "Transmitting the message to endpoint http://HGSGXI50:8000/sap/xi/engine?type=entry using connection RFC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Received HTTP response code 500 : Internal Server Error"
    thanks,

    HI
    for the error com.sap.aii.af.ra.ms.api.RecoverableException Received HTTP response code 500 Internal Server Error" 
    HTTP 500 can be any problem at receiver side. Are you sure, that the payload fits to the receiver requirements
    Please refer this thread answered by Stefan Grube
    Plain HTTP adapter error
    check the similar thread HTTP server code 500 reason Internal Server Error

  • How to send XML file to https server using POST

    Hi, I am having an requirement, that I have to connect to https server and I have to pass an input XML file as a response server will give me output XML file.
    The certificate validation part is over, I am using FileInputStream to read the XML file and attaching this to connection.getOutputStream(); but server is throwing me DTD does n't match.
    Can any body tell me how to send XML file, I have to use any DOM parser to send the XML file, suggest me and give me sample code.
    Thanks,

    Can anybody give me the solution

  • Error in file-file scenario: HTTP response contains status code 503

    Hi folks,
    I've encountered the foll error in file-file scenario:
    Testing file-file scenario (followed the blog: https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/flatFILETOFLATFILE&)
    Initially i was hving problems with recvr comm channel, which are now resolved. File is sent successfully but not recvd. I tried to modify the scenario above and change the file type to 'Text' but still got the same error.
    I've checked SICF -->default_host/xi/engine , we dont maintain logon data there. when i test the default_host/xi/engine service, it resolves into an ip addr as follows:
    http://<hostname>.<domain.com>:8001/sap/xi/engine?sap-client=<clientNo>
    (Also, we hv a BW system running on the same server ,which uses a fully qualified domain, while we dont which is why we get the above domain. Im not sure if there are any issues with that.)
    and we get the foll error:
    Error Code 10060: Connection timeout
    If i remove the domain manually, im prompted for userid/pwd and get the foll result:
    - <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP:Header />
    - <SOAP:Body>
    - <SOAP:Fault xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>SOAP:Client</faultcode>
      <faultstring>Pipeline specified in URL attribute (type) not existing</faultstring>
      <faultactor>http://sap.com/xi/XI/Message/30</faultactor>
    - <detail>
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="MESSAGE">URL_PIPELINE_NOT_FOUND</SAP:Code>
      <SAP:P1>/sap/xi/engine?sap-client=<clientNo></SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Pipeline ID , which is expected as value of attribute &quot;type&quot; in the URL, does not exist in the Integration Engine (URL = /sap/xi/engine?sap-client=811)</SAP:Stack>
      </SAP:Error>
      </detail>
      </SOAP:Fault>
      </SOAP:Body>
      </SOAP:Envelope>
    also, we dont hv any overload issues as this is dev env and not many of us are using the xi server. Would really appreciate if any of you can share your inputs on how to resolve this. Thanks!!
    cheers
    Prachi

    Hi ,
    Look in to this for all errors
    /people/krishna.moorthyp/blog/2006/07/23/http-errors-in-xi
    The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.
    Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.
    Possible Tips: Because of J2EE application com.sap.aii.af.ms.app not active
    • Try to (re)start the application using the Visual Administrator Choose Server --> Services --> Deploy --> View on Application or restart the J2EE engine
    • The problem is that not all J2EE services can be started by the J2EE. i.e Start the Visual Administrator and select Server->Services->Deploy in the tree on the left. On the right-hand side, choose the Runtime tab page. You see a tree in the right window with all applications if you select the APPLICATION radio button. Check if they are running, otherwise choose Start. Usually the J2EE engine starts all services automatically.
    • Refer SAP Note 803145,807000,791655
    <b>Award Points if found usefull.</b>

  • I write binary file (express) but can't read it (express)

    Hello,
    I have an application where I will acquire data from several sensors. For most of them (16) a relatively low sampling rate (10000Hz) will be fine, but, for one AE sensor I need a high sampling rate (50k - 100kHz). So, I've decided to store the data in binary format so as no to have way too big files.
    I try writing the files with the express module, and afterwards, in a new .vi, reading and graphing it to check it, but signals don't match.
    By now I'm working with simulated channels, so data stored in the file and read and graphed afterwards should be sine, but I don't see so.
    Any suggestions?

    Hello,
    I have tried my best cleaning up the wiring, but it's still pretty messy. I attach the complete program.
    My problem (still not solved) is that since EA needs to be measured at very high rate, I want to write it as binary data. But I cannot make it show me the correct data afterwards, with a different program, that doesn't matter.
    I would also like to know how to convert this saved data to MatLab... any suggestions? (should I post this in a new thread?)
    Regards,
    Usuario
    Attachments:
    program_00.vi ‏297 KB

  • How to read and write Xml file at client side using JavaScript !

    Hello,
    i am new to javascript.
    I have requirement to read and update XML file at client side.
    Will you please guide what could be the best way to read and update XMl file using javascript.
    Thanks,
    Zuned

    This is a Java forum,not a Javascript forum. Maybe you should ask here [http://www.webdeveloper.com/forum/forumdisplay.php?forumid=3&s|http://www.webdeveloper.com/forum/forumdisplay.php?forumid=3&s].

  • Read and Write Binary File

    Hi...
    I have a problem. In C programming, if we want to read a file, we can determine to read it as text or binary. There is difference between them. But we still can read it in ASCII mode.
    My problem is :
    How to do that in Java ? I want to read any file in binary and I hope can read it in ASCII(8 bit) mode.
    I need it...
    Thanks for your help

    Hi,
    Check this link
    http://saeta.physics.hmc.edu/courses/p170/code/files.html#Java
    Gives you an example where you can see how to open a files for input or output in Binary or text mode.
    Hope this helps.
    Regards,
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • How do i asynchronously write binary files?

    Hi
    I'm sure I'm missing something obvious here but I cant see
    what's wrong with my code. I'm trying to save a file using
    asynchronous methods but for some reason the function
    onCompleteFunc is not being called. Any ideas what I'm doing wrong?
    function testSaving(fileObj, binaryData, onSuccessFunc,
    onErrorFunc){
    var onCompleteFunc = function(event){
    try {
    stream.writeBytes(binaryData, 0, binaryData.length);
    catch (fileError) {
    onIoErrorFunc();
    stream.close();
    onSuccessFunc();
    var onIoErrorFunc = function(event){
    stream.close();
    onErrorFunc(event);
    var stream = new air.FileStream();
    stream.addEventListener(air.Event.COMPLETE, onCompleteFunc);
    stream.addEventListener(air.IOErrorEvent.IO_ERROR,
    onIoErrorFunc);
    stream.openAsync(fileObj, air.FileMode.WRITE);
    }

    FileStream dispatches a COMPLETE event when the end of the
    file is reached during an asynchronous read. When you're writing
    asynchronously, you don't need to wait for any events to start
    writing.
    When you're done writing, call close() and then wait for the
    CLOSE event, which signals that all data has been written to the
    file.
    Oliver Goldman | Adobe AIR Engineering

  • How to read and write Binary files from Forms 6i C/S ?

    Hi There,
    I have a situation, where user wants to store attachements to a record (Could be any type of file, TXT, TIFF, or Word Doc etc.) and wanted to retreive later if they wanted to edit/read.
    We are using forms 6i and Oracle 9i in client/server environment setup. Does anybody know how to solve this requirment. I'm ale to load image files with read_image_file, but it could be text some times and it could be some thing elses like word doc or excel.
    Also i have to give user an option to view existing file attachments. I'm Planing to use BLOB in database table to store files.
    Any help in this regards is appreciated

    Thanks,
    Venkat

  • How to read/write text file to db2 by using java code

    Hai
    I created the table to insert a clob data as follows
    db2 => create table ctest(datas clob(65536))
    DB20000I The SQL command completed successfully.
    db2 => describe table ctest
    Column Type Type
    name schema name Length Scale Nulls
    DATAS SYSIBM CLOB 65536 0 Yes
    1 record(s) selected.
    I tried the following java code to insert a clob data.
    public static synchronized Connection getConnection() throws Exception {
    Connection m_connectionDatabase = null;
    try {
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    // Get the connection to the database.
    m_connectionDatabase = DriverManager.getConnection(
    "jdbc b2 ps","","");
    }catch (Exception e) {
    throw new Exception("Failed to connect to the database. ", e);
    return m_connectionDatabase;
    public static void main(String a[]) {
    File file = new File("d:\\a.txt");
    InputStream fis = new FileInputStream(file);
    Connection con = getConnection();
    PreparedStatement pstmt = con.prepareStatement("insert into ctest values(?)");
    //try 1
    pstmt.setAsciiStream(1,fis,(int)file.length());
    // try 2
    pstmt.setCharacterStream(1,fis,(int)(file.length()));
    // try 3
    pstmt.setBinaryStream(1,fis,(int)(file.length()));
    // try 4
    byte[] b = new byte[fis.available()];
    fis.read(b);
    pstmt.setBytes(1, b);
    // try 5
    byte[] b = new byte[fis.available()];
    fis.read(b);
    pstmt.setString(1, new String(b));
    pstmt.executeUpdate();
    pstmt.close();
    fis.close();
    Result:
    If the file size is less than 32kb, it inserted successfully.
    but if more than 32kb, it throws follwing exception
    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0352N An unsupported SQLTYPE was encountered in position "1" of the input list (SQLDA). SQLSTATE=56084
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.loadParameters(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
    Can any body please help out to insert clob value.
    Thanks in advance
    V.Shan

    Normally I would be happy to help you, but after several years of trying to help here, I've decided not to contribute anymore because of the piss-poor way in which this site is being administered.
    Others are still helping, but more may leave if things don't improve. May I recommend devshed or javaranch?
    http://www.devshed.com/
    http://www.javaranch.com/
    If you would like to complain to the admins of this forum, either click the "Report Abuse" link or the "Feedback" link.
    -- foofoo (shamelessly stolen the text from jverd).

  • Write to binary file

    I have a relatively large 3D array (Phase Settling), which I want to store in a Binary File. The array is a 15000 point sweep (after decimation), repeated up to 48 by 48 times (in two FOR loops, one inside the other), meaning it can end up having as many as 34,560,000 data points. At the moment, I am attempting to dump that 3D array into a Binary File in one go, using the following VI. There are two possile versions of this array (both the same size as each other) and, depending on which has just been tested, they will be written to their own individual file. Once both tests have been run and their results stored, the idea was to open both files, subtract one array from the other, and store the new 3D array to another Binary File whilst also displaying this latest data elsewhere in a higher-level VI.
    After its first trial run, LabVIEW presents me with an error message saying something along the lines of "LabVIEW had run out of memory". I assume it would be to do with this VI, since that's where the first error code appeared (Error Code: 2), apparently originating in a 'Write to Binary File' function.
    Any ideas as to how I could get round this first hurdle, or perhaps an alternative method I could try?
    Thank you.
    - James
    Message Edited by James Mamakos on 04-08-2010 10:07 AM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    Running out of LabVIEW memory when writing to binary file.PNG ‏30 KB

    Well, as shown in the attached screen-shot, the error indicator shows an error code of 2, and that the error occurred in one of the Write to Binary File functions.
    However, when trying to save this particular VI after a couple of tweaks, I was presented with the following pop-up alert message:
    LabVIEW:  Memory is full.
    Cannot save VI "Compare Amp - calculate.vi".
    LabVIEW Save error code 10: Default data space.
    Anyway, returning back to the main problem at hand, I've though of a couple of possible solutions...
    We don't really need a particularly high resolution to the data points for the comparison, so I could convert the array doubles into an array of singles to save space.
    I should be able to implement the 'Write to Binary File' for the initial arrays into the outer FOR loop, thereby reducing the amount data written in each instance by a factor of up to 48. The only problem I can foresee in this is that I'm not sure how to append 2D arrays into a binary file such that, when the file is read, they would appear as (or be easily converted into) a 3D array.
    As for the 'True' case in my case structure, am I being grossly inefficient in my passing of data from one place to the next? I know there are a lot of branches (and buffers?) of 3D arrays; is there a decent way to reduce this overhead by tweaking the data paths or something?
    - James
    P.S. The computer I'm using has 1GB RAM.
    Message Edited by James Mamakos on 04-08-2010 12:39 PM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    LabVIEW - error code 2.PNG ‏35 KB

  • Db- put blocks sometimes, mulit-thread uses Db- put to write DB file

    My environment : redhat Linux 5, gcc version 4.1.2
    BDB version: 4.8.24
    Hi Guys
    I used multi-thread application to write DB file. The application used Transactional Data Store and I used flags DB_TXN_NOSYNC . The DB file type is BTREE. I give 180M for the buffer cache and 8M for the log cache. And I used Db->put to write DB file ; five threads is used.
    But the Db->put will block for one or two seconds sometimes.
    Now I have found that the problem is in the  lock/lock.c :: __lock_get_internal , line 953 :  MUTEX_LOCK(env, newl->mtx_lock);. My application blocks here .+_
    Could anyone give me some advice to avoid these blocks as possible as we can?
    By the way, I have tried many of the lock set APIs which BDB offered. No effect -_- .
    Thanks

    Hi,
    You should have posted this new piece of information in the original thread you opened:
    Db->put block sometimes , when mulit-thread uses Db->put to write DB file
    In the future please do not open a new thread for a problem you already reported.
    Now I have found that the problem is in the  lock/lock.c :: __lock_get_internal , line 953 :  MUTEX_LOCK(env, newl->mtx_lock);. My application blocks here .+_This only confirms that one of your threads is blocked waiting for a requested lock, which is already held by another thread. Until the thread that holds the lock will not have released it, your thread waiting on it will not make progress.
    You can collect the locking statistics at the moment you observe the slowness using either the db_stat utility with the -CA or -Co options (if the environment is not opened with DB_PRIVATE, that is, backing its region files into per-process private/heap memory) or programmatically using DB_ENV->lock_stat_print():
    [http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/db_stat.html]
    [http://www.oracle.com/technology/documentation/berkeley-db/db/api_reference/C/lockstat_print.html]
    Examining the locking statistics will help determine what is the problematic lock, what is the locked object and which thread is holding it.
    In addition to standard deadlock detection you can look into configuring lock timeouts. If your lock request is not satisfied within a given time it will time out and return DB_LOCK_DEADLOCK or DB_LOCK_NOTGRANTED. Lock timeouts may be configured per environment wide basis or per-lock or per-transaction basis:
    [http://www.oracle.com/technology/documentation/berkeley-db/db/programmer_reference/lock_timeout.html]
    [http://www.oracle.com/technology/documentation/berkeley-db/db/gsg_txn/C/lockingsubsystem.html#configdeadlkdetect]
    As Mike already suggested it would help if you could put together a test case program to demonstrate this issue.
    Regards,
    Andrei

  • How to use vn_rdwr() to write to file  in  a driver context?

    hi!
    i now am trying to write to file in a driver using vn_rdwr(),but
    it returns a value 0x1b ,i think the ioflag parameter is the
    reason for it ,so i kadb into ufs :wrip ,here (wrip) it return
    the 0x1b ,but it seemed the result is unrelationed to the ioflag.
    so what's the reason?
    if i do want to write in this way ,do i need to analysize
    the file system and vm every inch?

    Leaving behind the long discussion of DDI/DDK compliance of the thing
    (see it in old threads here and in Kernel - about half a year ago),
    I can tell you that the thing works for me... Still, wouldn't use it in driver (I have no choice in file system though).
    The return value of vn_* family seems to be the errno,
    so 0x1b == 27 == EFBIG...
    As for flags - see /usr/include/sys/vnode.h for appropiate enums.
    Once more - are you 100% sure you need your driver to write anything to file? There are conventional ways of driver-userland communication (notably, the ioctl() entry point)...
    Hope this helps...
    Sincerely,
    Ilya.
    P.S. You may be pretty sure that your driver won't work in the next version of Solaris if you'll use vn_* functions in it...

  • When I try to download a .exe file extension, Firefox designates it as a binary file which is useless to me.

    using Windows 7 with i3 processor all the latest updates. Firefox is the ONLY browser that gives me this problem. I should not have to turn off my antivirus or go into my config files, write code or anything to have this simple task to work. If I buy a download for a program and get one shot at the download which is an executable file, I should not have it come up as a Binary file and can not use it to load the program that I just ordered.

    Sorry you are having problems. Can you give an example preferably of some small publicly available file and the site you are trying to download it from ?
    As a simple example of a download (ok it is a .png image file not not a .exe file) but can you try to download a copy of your avtar/icon, as used on these forums. In Windows one method is that you right click & should get an option save. <br/> Mine alongside uses the link
    * https://support.mozilla.com/media/uploads/avatars/avatar-257447.png
    Are you able to download such an image, then see it in your download manager, and find it on your computer.
    Once you have got Firefox to save your binary file you can use it. In the case of the .exe file you are trying to download that should be usable as intended with your Windows Operating System, the avatar also should be easily opened and viewed.
    P.S.
    You could try installing the add-on https://addons.mozilla.org/en-US/firefox/addon/opendownload-10902/ if you wished to adapt Firefox to run .exe files instead of just save them.

  • UTL_FILE write_error when writing large binary files to unix os

    I am trying to write large files to a folder in unix from a table containing a BLOB object. The procedure below is called by another procedure I have written to do this. It works in windows environment fine with files up to 360MB. When I run this exact same procedure in UNIX I get an initialization error. When I change the WB in the fopen call to W it works. I can store all the files I want up to 130MB in size. The next size larger file I have is 240MB and it fails after writing the first 1KB passing the utl_file.write_error message. If someone can help me to diagnose the problem, I would really appreciate it. i have been trying everything I can think of to get this to work.
    Specifics are, the windows version is 10GR2, on unix we are running on Sun Solaris 9 using 9iR2
    PROCEDURE writebin(pi_file_name IN VARCHAR2, pi_file_url IN VARCHAR2, pi_file_data IN BLOB)
    IS
    v_file_ref utl_file.file_type;
    v_lob_size NUMBER;
    v_raw_max_size constant NUMBER := 32767;
    v_buffer raw(32767);
    v_buffer_offset NUMBER := 1;
    -- Position in stream
    v_buffer_length NUMBER;
    BEGIN
    -- WB used in windows environment. W used in unix
    v_lob_size := dbms_lob.getlength(pi_file_data);
    v_file_ref := utl_file.fopen(pi_file_url, pi_file_name, 'WB', v_raw_max_size);
    v_buffer_length := v_raw_max_size;
    WHILE v_buffer_offset < v_lob_size
    LOOP
    IF v_buffer_offset + v_raw_max_size > v_lob_size THEN
    v_buffer_length := v_lob_size -v_buffer_offset;
    END IF;
    dbms_lob.READ(pi_file_data, v_buffer_length, v_buffer_offset, v_buffer);
    utl_file.put_raw(v_file_ref, v_buffer, TRUE);
    v_buffer_offset := v_buffer_offset + v_buffer_length;
    END LOOP;
    utl_file.fclose(v_file_ref);
    END writebin;
    Message was edited by:
    user599879

    check if this cample code helps -
    CREATE OR REPLACE PROCEDURE prc_unload_blob_to_file IS
    vlocation      VARCHAR2(16) := ‘LOB_OUTPUT’;
    vopen_mode     VARCHAR2(16) := ‘w’;
    bimax_linesize NUMBER := 32767;
    v_my_vr        RAW(32767);
    v_start_pos    NUMBER := 1;
    v_output       utl_file.file_type;
    BEGIN
    FOR cur_lob IN (SELECT vmime_type,
    blob_resim,
    vresim,
    dbms_lob.getlength(blob_resim) len
    FROM tcihaz_resim a
    WHERE rownum < 3 -- for test purposes
    ORDER BY a.nresim_id) LOOP
    v_output := utl_file.fopen(vlocation,
    cur_lob.vresim,
    vopen_mode,
    bimax_linesize);
    dbms_output.put_line(’Column length: ‘ || to_char(cur_lob.len) || ‘ for file: ‘ ||
    cur_lob.vresim);
    v_start_pos := 1;
    IF cur_lob.len < bimax_linesize THEN
    dbms_lob.READ(cur_lob.blob_resim,
    cur_lob.len,
    v_start_pos,
    v_my_vr);
    utl_file.put_raw(v_output,
    v_my_vr,
    autoflush => TRUE);
    dbms_output.put_line(’Finished Reading and Flushing ‘ || to_char(cur_lob.len) ||
    ‘ Bytes’ || ‘ for file: ‘ || cur_lob.vresim);
    ELSE
    dbms_lob.READ(cur_lob.blob_resim,
    bimax_linesize,
    v_start_pos,
    v_my_vr);
    utl_file.put_raw(v_output,
    v_my_vr,
    autoflush => TRUE);
    dbms_output.put_line(’Finished Reading and Flushing ‘ || to_char(cur_lob.len) ||
    ‘ Bytes’ || ‘ for file: ‘ || cur_lob.vresim);
    END IF;
    v_start_pos := v_start_pos + bimax_linesize;
    WHILE (v_start_pos < bimax_linesize) LOOP
    -- loop till entire data is fetched
    dbms_lob.READ(cur_lob.blob_resim,
    bimax_linesize,
    v_start_pos,
    v_my_vr);
    utl_file.put_raw(v_output,
    v_my_vr,
    autoflush => TRUE);
    dbms_output.put_line(’Finished Reading and Flushing ‘ ||
    to_char(bimax_linesize + v_start_pos - 1) || ‘ Bytes’ ||
    ‘ for file: ‘ || cur_lob.vresim);
    v_start_pos := v_start_pos + bimax_linesize;
    END LOOP;
    utl_file.fclose(v_output);
    dbms_output.put_line(’Finished successfully and file closed’);
    END LOOP;
    END prc_unload_blob_to_file;
    set serveroutput on
    set timing on
    create or replace directory LOB_OUTPUT as ‘/export/home/oracle/tutema/’;
    GRANT ALL ON DIRECTORY LOB_OUTPUT TO PUBLIC;
    exec prc_unload_blob_to_file ;
    Column length: 3330 for file: no_image_found.gif
    Finished Reading and Flushing 3330 Bytes for file: no_image_found.gif
    Finished successfully and file closed
    Column length: 10223 for file: OT311.gif
    Finished Reading and Flushing 10223 Bytes for file: OT311.gif
    Finished successfully and file closed
    PL/SQL procedure successfully completedWith 9iR2 PLSQL can write binary files using UTL_FILE put_raw function, prior to Oracle9iR2 you will need to create an external procedure with Java, C, VB or some 3gl language.
    Some references -
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:6379798216275
    Oracle® Database PL/SQL Packages and Types Reference 10g Release 2 (10.2)
    UTL_FILE - http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14095
    http://psoug.org/reference/dbms_lob.html
    Metalink Note:70110.1, Subject: WRITING BLOB/CLOB/BFILE CONTENTS TO A FILE USING EXTERNAL PROCEDURES

Maybe you are looking for

  • I deleted my foxfire profile contents and now get firefox is already running error. reinstall did not help

    I deleted the contents of my profile. Now i get the firefox is already running error. i realize that i screwed up. i have restarted, uninstalled, reinstalled, but still firefox will not load.

  • Cmd L- Genres Grid View?

    Hi, I used to use Command L to go to current song, but every time I use either the keyboard shortcut or the View menu "Go to Current Song" I am taken to the Genres Grid view. So how do I get it working again? iTunes 9.2.1 (4)

  • ABC COPA, how to derive charateristic value from BKPF-XBLNR

    Hello, As we only use FI-CO modules in our SAP solution, I am implementing the ABC COPA I have created one characteristic (user defined, with reference to existing field - data element XBLNR1) When I post my invoice I want to pass the value in the BK

  • How to display TIFF images?

    Hello all. My web application needs tiff images viewer with a very primitive functionality like zoom. I'm a new in working with graphics and it seems like java.awt.image package doesn't support TIFF images format. From searching this forum I understo

  • E-commerce functionality

    please could you let me know whether e-commerce is the standard funtionality of sap business one or is it an add-on.If it is standard funtionality, could you tell how to enable that functionality ?