Problem when downloading file to local using WPG_DOCLOAD.download_file

Hi ,
i am using database 11g and i am trying to write to file on database server using utl_file and download to the local machine by pl/sql procedure . i am directly executing this procedure in pl/sql . i am getting ORA-06502: PL/SQL: numeric or value error when executing owa_util.mime_header ('application/vnd.ms-excel',TRUE); statement in the procedure . not sure what is happening and i am new in using these features
here is my code
CREATE OR REPLACE PROCEDURE UTL_TEST_DOWNLOAD
AS
output_file utl_file.file_type;
vexists BOOLEAN;
vfile_length NUMBER;
vblocksize NUMBER;
l_blob BLOB;
l_bfile BFILE;
BEGIN
output_file:=UTL_FILE.FOPEN('DATA_DIR', 'timesheet.csv', 'w');
UTL_FILE.PUT_LINE(output_file,'COST_CENTRE'||
'HISTORY_DATE'||
'REF_NO'||
'FIELD_NAME'||
'VALUE'||
'DATA_TYPE'||
'CHANGE_DATE'||
'INT_REF');
UTL_FILE.fclose(output_file);
UTL_FILE.FGETATTR('DATA_DIR','timesheet.csv',vexists,vfile_length,vblocksize);
IF vexists THEN
DBMS_LOB.createtemporary (l_blob, TRUE, DBMS_LOB.SESSION);
l_bfile := BFILENAME ('DATA_DIR', 'timesheet.csv');
DBMS_LOB.fileopen (l_bfile,dbms_lob.file_readonly);
DBMS_LOB.loadfromfile (l_blob, l_bfile, DBMS_LOB.getlength (l_bfile));
DBMS_LOB.fileclose (l_bfile);
owa_util.mime_header ('application/vnd.ms-excel',TRUE);
dbms_output.put_line('after owa_util' );
owa_util.http_header_close;
WPG_DOCLOAD.download_file (l_blob);
end if;
EXCEPTION
WHEN utl_file.invalid_path THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_path');
WHEN utl_file.invalid_mode THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_mode');
WHEN utl_file.invalid_filehandle THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_filehandle');
WHEN utl_file.invalid_operation THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_operation');
WHEN utl_file.read_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.read_error');
WHEN utl_file.write_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.write_error');
WHEN utl_file.internal_error THEN
RAISE_APPLICATION_ERROR(-20001, 'utl_file.internal_error');
WHEN OTHERS THEN
dbms_output.put_line('SQLERRM '||SQLERRM);
END UTL_TEST_DOWNLOAD
SQLERRM ORA-06502: PL/SQL: numeric or value error
The file is getting created all the time i execute this procedure i am getting the above error while executing this statement owa_util.mime_header ('application/vnd.ms-excel',TRUE);
Edited by: user5784286 on Jul 2, 2012 7:35 PM

Hi,
You need to call the procedure owa.init_cgi_env before you can use owa_util.mime_header from SQL*Plus.
See [url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:500221786045]here for details.
Rod West

Similar Messages

  • Don't able to download file to local using window pop-up with IE

    Dear all,
    I am working in web dynpro for java, i want to download file to local using window pop-up , here is my code :
    IWDResource resource = WDResourceFactory.createResource(blacklistData.getBytes(), allblFilename, WDWebResourceType.TXT);
    IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(
                     resource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()));           
    window.show();
    It runs in Firefox browser very well, but IE can not run. :(. How to resolve my problem ?
    @Note : version Firefox is 3.6, IE is 8.0
    Thanks.

    Hi Soledad
    Please check browser compatibility of the webdynpro iview for server version.
    Refer to Product Availability Matrix :  [http://service.sap.com/pam|http://service.sap.com/pam]
    Best Regards
    Arun Jaiswal

  • A very disturbing Safari 6 problem when downloading files

    After downloading a file from Hubspot.com, this is what I see when clicking on the Show Downloads button on Safari 6. This is actually the third time it's happened. I did a clean install of OS X 10.8 to see if the problem would go away. Sadly, it didn't.
    Is anyone experiencing the same problem?

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • TS5179 I've been bitten by the "Missing MSVCR.dll file" problem when downloading the latest iTunes update (PC w/ Win-7 & Outlook-2007#. 'Have followed Apple's instructions of un-installing all Apple software, and re-installing it. #out of space...??)

    I've been bitten by the "Missing MSVCR.dll file" problem when downloading the latest iTunes update, 11.4.62 (on a PC w/ Win-7 & Outlook-2007#. 'Have followed Apple's instructions of un-installing all Apple software, and re-installing it (Ugh).  First result Outlook couldn't find my 1,385 item contact file in iCloud, although the outlook distribution lists were there.  Second result, upon installing iCloud again, I have two iCloud contact files shown in outlook - "iCloud" & iCloud, within iCloud".  1,332 & 1,385 contacts respectively. 
    Plus an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  This is NOT fun at 72-yrs old...!!
    So, how do I make sure I haven't lost anythying from Outlook?   Russ-AZ

    Interesting response, Kappy  -  Back to original post: "First result: Outlook couldn't find my 1,385 item contact file in iCloud, although the outlook distribution lists were there (therefore, initially I had lost my contact file from Outlook).  Second result, upon installing iCloud again, I now have two iCloud contact files shown in Outlook - "iCloud" & iCloud, within iCloud".  W/ 1,332 & 1,385 contacts respectively.  
    Plus an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  This is NOT fun at 72-yrs old...!!
    So, how do I make sure I haven't lost anythying from Outlook?   Russ-AZ"
    You can safely assume that I have tried using it!   So, to make things a little clearer:
         1)  I now have two iCloud "contacts files", w/ a different total count. What's the difference?  Why the different toatl count?
         2)  Since re-installing the Apple software (part of the MSVCR" recovery instructions) "couldn't possible affected Outlook", why am I getting an iCloud installation error message saying iCloud moved 6,835 files to a "deleted items folder" somewhere.  What's in those files? And where are they?
    Probably more important questions get down to:
         3)  Why is a basic Apple product upgrade "screwing-up Outlook"?  This iTunes upgrade, failing to install properly forced Outlook 2007 into a 2-min start-up cycle.  Which was fixed with this "Goat-Rpdeo" of re-installing MSVCR80.dll.
         4)  And under the latest release of iOS-7.0.4 on our iPhones, why is Apple now forcing us to use the iCloud to back-up our contacts, calendars & tasks, vs. allowing these files to be backed-up directly on our PC's via the USB cable?
    Thanks again for your interest and comments.  - Russ-AZ

  • Error when downloading large SharePoint document using REST API

    Hello,
    The following code works fine for small files, but I got "SCRIPT14: Not enough storage is available to complete this operation." error when downloading files over 100M.
    Is it possible to write the data directly to a local storage (IndexedDB for example) instead of keeping it in memory?
            var getFileEndpoint = String.format(
                 "{0}/_api/SP.AppContextSite(@target)/web/getfilebyserverrelativeurl('{1}')/$value?@target='{2}'",
                 _SPAppWebUrl, _DocumentUrl, _SPHostUrl);
            var executor = new SP.RequestExecutor(_SPAppWebUrl);
            var info = {
                url: getFileEndpoint,
                method: "GET",
                //binaryStringResponseBody: true,
                success: function (data) {
                    //Save data to IndexedDB
                error: function (err) {
                    //Error handling
            executor.executeAsync(info);
    Since my page is located in a SharePoint Hosted App, I can't use XMLHttpRequest directly to access the document in the host site. Seems like the MS cross-domain library is the only choice to me.
    Thanks,
    Matt.
    Matt

    Hi,
    Per my understanding, you might want to download the content of files into database in SharePoint Hosted App.
    In SharePoint Hosted App, as we can only use JavaScript which is supposed to be executed in browser, the content retrieved will be stored in memory then to the local hard drive.
    As a workaround, I suggest you develop a Provider Hosted App and do the same job there instead. In Provider Hosted App, we can use C# to handle the file downloading which should
    be more appropriate in your scenario.
    About
    how to download file using SharePoint Client Object Model:
    http://www.lucacostante.com/item/15-download-and-upload-files-via-sharepoint-client-object-model.html
    Thanks
    Patrick Liang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Windows 8.1 account limit problem when downloading from store

    windows 8.1 account limit problem when downloading from store        
    I have 250 windows 8.1 tablets.
    I figured since you can use the same account on 81 devices id create 4 accounts.
    I need to download more than 25 free apps from the store
    on each tablet. Putting the same account don't work. (comes up with an error after putting on to many devices that you cant use this account now).
    Whats the best way to do this ? and what if I need to download a paid app ?
    Thank You.

    Hi,
    As far as I know, One Microsoft Account may bound at most five Trusted computers. There is no way to break this limitation.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to upload & Download file in Adf using Jdeveloper 11.1.2 ??

    Hi All,
    I have just started working on Oracle ADF, Thanks a lot guys for solving our queries.
    I'm using Jdeveloper 11.1.2, How to upload and download file in ADF..?
    I have seen couple links on net but none of them worked on jdeveloper 11.1.2......
    Please Help......

    Hi guys,
    I'm able to download file in ADF using af:fileDownloadActionListener.......
    does any one knows how to upload a file using ADF???

  • [svn:fx-gumbo_beta2] 10484: Fix for autoCenter problem when Move/ Resize effects are used.

    Revision: 10484
    Author:   [email protected]
    Date:     2009-09-21 19:38:14 -0700 (Mon, 21 Sep 2009)
    Log Message:
    Fix for autoCenter problem when Move/Resize effects are used. autoCenterTransform calculates the center dynamically, using the current width/height of the target. This calculation can be one frame off if a Resize effect is running in parallel with the transform effect. Also, containers do their validation lazily, so they need to be forced to validate in order to have an up-to-date width/height. This fix addresses these problems by reordering the effects in a Parallel hierarchy to put the Resize effects (and composite effects containing Resize) at the front of the set of effects and by calling validateNow() on the target of a transform effect prior to calculating the transform center (if appropriate).
    QE notes: None
    Doc notes: None
    Bugs: SDK-23306
    Reviewer: Jason
    Tests run: checkintests, Mustella spark/effects mx/effects, manual tests
    Is noteworthy for integration: Yes
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23306
    Modified Paths:
        flex/sdk/branches/gumbo_beta2/frameworks/projects/framework/src/mx/effects/effectClasses/ CompositeEffectInstance.as
        flex/sdk/branches/gumbo_beta2/frameworks/projects/framework/src/mx/effects/effectClasses/ ParallelInstance.as
        flex/sdk/branches/gumbo_beta2/frameworks/projects/spark/src/spark/effects/supportClasses/ AnimateTransformInstance.as

    Dear Pallavi,
    Very useful post!
    I am looking for similar accelerators for
    Software Inventory Accelerator
    Hardware Inventory Accelerator
    Interfaces Inventory
    Customization Assessment Accelerator
    Sizing Tool
    Which helps us to come up with the relevant Bill of Matetials for every area mentioned above, and the ones which I dont know...
    Request help on such accelerators... Any clues?
    Any reply, help is highly appreciated.
    Regards
    Manish Madhav

  • Download file to local machine using WPG_DOCLOAD.download

    Hi ,
    i am using database 11g and i am trying to write to file on database server using utl_file and download to the local machine by pl/sql procedure . i am directly executing this procedure in pl/sql . i am getting ORA-06502: PL/SQL: numeric or value error when executing owa_util.mime_header ('application/vnd.ms-excel',TRUE); statement in the procedure . not sure what is happening and i am new in using these features
    here is my code
    CREATE OR REPLACE PROCEDURE UTL_TEST_DOWNLOAD
    AS
    output_file utl_file.file_type;
    vexists BOOLEAN;
    vfile_length NUMBER;
    vblocksize NUMBER;
    l_blob BLOB;
    l_bfile BFILE;
    BEGIN
    output_file:=UTL_FILE.FOPEN('DATA_DIR', 'timesheet.csv', 'w');
    UTL_FILE.PUT_LINE(output_file,'COST_CENTRE'||
    'HISTORY_DATE'||
    'REF_NO'||
    'FIELD_NAME'||
    'VALUE'||
    'DATA_TYPE'||
    'CHANGE_DATE'||
    'INT_REF');
    UTL_FILE.fclose(output_file);
    UTL_FILE.FGETATTR('DATA_DIR','timesheet.csv',vexists,vfile_length,vblocksize);
    IF vexists THEN
    DBMS_LOB.createtemporary (l_blob, TRUE, DBMS_LOB.SESSION);
    l_bfile := BFILENAME ('DATA_DIR', 'timesheet.csv');
    DBMS_LOB.fileopen (l_bfile,dbms_lob.file_readonly);
    DBMS_LOB.loadfromfile (l_blob, l_bfile, DBMS_LOB.getlength (l_bfile));
    DBMS_LOB.fileclose (l_bfile);
    owa_util.mime_header ('application/vnd.ms-excel',TRUE);
    dbms_output.put_line('after owa_util' );
    owa_util.http_header_close;
    WPG_DOCLOAD.download_file (l_blob);
    end if;
    EXCEPTION
    WHEN utl_file.invalid_path THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_path');
    WHEN utl_file.invalid_mode THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_mode');
    WHEN utl_file.invalid_filehandle THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_filehandle');
    WHEN utl_file.invalid_operation THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.invalid_operation');
    WHEN utl_file.read_error THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.read_error');
    WHEN utl_file.write_error THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.write_error');
    WHEN utl_file.internal_error THEN
    RAISE_APPLICATION_ERROR(-20001, 'utl_file.internal_error');
    WHEN OTHERS THEN
    dbms_output.put_line('SQLERRM '||SQLERRM);
    END UTL_TEST_DOWNLOAD
    SQLERRM ORA-06502: PL/SQL: numeric or value error
    The file is getting created all the time i execute this procedure i am getting the above error while executing this statement owa_util.mime_header ('application/vnd.ms-excel',TRUE);

    Hi,
    it seems your issue is with PLSQL product so I would suggest to post your question in the PLSQL forum.
    reference
    PL/SQL
    REgards, Roberto

  • Problems when downloading a file using jspsmartupload

    i am using jakarta tomcat 4.03 in linux ....
    to upload the file its ok .... im using this code here :
    String path = application.getRealPath("/upload");
    try {
    count = mySmartUpload.save(path);
    it works fine ......
    but when i try to download ..... putz .... its a f$##%#$% hell
    anybody knows how to download ???

    hi thr...
    see since i am using javawebserver i have a public html folder whr i have saved all the files which the site accesses . Now in the public html folder i have made a folder upload and i upload all the files to this folder.
    count = mySmartUpload.save("/upload/");
    Now for download use this ...
    <%@ page language="java" import="com.jspsmart.upload.*"%><jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><%
         // Initialization
         mySmartUpload.initialize(pageContext);
         // Download file
         mySmartUpload.downloadFile("/upload/sample.zip");
    %>
    this should work ...
    if this doesnt lemme know
    prob u r path should be ("/upload/")
    u have given as ("/upload"); try this 2 ... and do lemme knw

  • UNICODE Problem when Download to TXT/ASC file.

    Dear Experts,
    Due to the Unicode system takes each chinese character as a byte, the field(10) can take 10 Chinese Characters, not like before only 5 characters allowed.
    The problem is when the data is downloaded to a txt file, the field ,length 10, contained Characters, is displayed 10 chinese characters(that's 20 bytes in txt file). It causes the displayed field length are varied between the definition length of field and the actual output.
    ex.
    102’†•¶ŽšŒ^‘ª00012345       --> the output I actully want.
    102’†•¶ŽšŒ^‘ª     000012345  --> unicode makes this in txt file, lenth 10, fill 5 characters but still leave 5 space.
    How to make system take the chinese characters as 2 bytes when download....or any other better idea for this?
    anyone who can solve this, that's life saving..!!!
    thanks in advnace.

    Sorry, the chinese chararcters cannot display properly,
    so just assume each '@' as a chinese character. Five chinese Characters should occupy whole field length(10),
    but Unicode makes it like line 2, still leave 5 space culomn behind(using  to represent the empty column).
    ex.
    102@@@@@00012345      --> the output I actully want.
    102@@@@@000012345 -- the actual output.
    thanks.
    Message was edited by: Ching Heng Ling

  • UNICODE Problem when Download/Upload from ASC file.

    Due to the Unicode system takes each Chinese character as a byte, the field(10) can take 10 Chinese Characters, not like before only 5 characters allowed.
    The problem is when the data is downloaded to a txt file, the field ,length 10, contained Characters, is displayed 10 Chinese characters(that's 20 bytes in txt file). It causes the displayed field length are changed.
    ex.
    text = '12@@@@@00012345'.
    text = text+0(12) --> display '12@@@@@' the output I actually want.
    text = text+0(12) --> display '12@@@@@00012' Unicode makes this in txt file,
    the Chinese characters cannot display properly, so just assume each '@' as a Chinese character.
    How to make system take the Chinese characters as 2 bytes when download....or any other better idea for this?
    anyone who can solve this, thanks in advance.

    Hi Prashant and Uwe,
    Thanks for your help. I used 'GUI_UPLOAD', but it still doesn't work.
    'Text1' still equal to '12@@@@@00012' , not '12@@@@@'
    My test problem as below:
    data: l_file type string.
            text1(20) type c.
    DATA: BEGIN OF T_FICH OCCURS 0,
             LIGNE(5000),
          END OF T_FICH.
      l_file = P_SOURCE.
      CALL FUNCTION 'GUI_UPLOAD'
           EXPORTING
                FILENAME            = l_file
               FILETYPE            = 'ASC'
               HAS_FIELD_SEPARATOR = 'X'
               Read_By_Line        = 'X'
                CODEPAGE            = '8400'
           TABLES
                DATA_TAB            = T_FICH
           EXCEPTIONS
                OTHERS              = 99.
    LOOP AT T_FICH.
       text1 = T_FICH-LIGNE+0(12).
    ENDLOOP.
    Could you give me some advise about this?

  • Problem when downloading the JAR file

    I'm just install JRE and testing my first applet application. I'm facing the problem that I can not download the JAR file from my localhost computer.
    I've enable cache in Java Control Panel and running my applet. Normally, it will download the jar file from my localhost and save it to the cache directory of Java. And then finding all classes neccessary to run my applet in the JAR file.
    But I discover that I can not download the JAR file and save to my computer. I try to put the URL to download this JAR file (http://localhost/myjar.jar) in my web address, it start to download this file properly. But when open it with WINRAR, I got an error that the file "Unexpected end of file".
    I try to put this file from onther computer in my LAN. And use the URL to download it. This time I can open the JAR file with WINRAR althrought the file size is the same
    Anyone know why there are some errors when download from my localhost? Thanks in advance for any help!!!

    Yeah everything matches up!
    Could it have something to do with the string encoding? I created the file in ANSI format? Would this have an effect on it?

  • How to download file to local system when report is run in background?

    Hello all,
    Can anybody tell me how can we donwload file into local machin when the program is running in background?
    thanks

    Hi,
    We can't communicate with presentation server while processing in background.
    if needed we can do this by creating RFC destination and doing some setting in Desktop system.
    [Reference document|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2]
    Regards,
    Amal

  • Either there's no "Open or save as"-Popup, when downloading files (although it's set in preferences) or nothing happens when I click "save as". Please help me. I'm using Iceweasel 7.0.

    In my preferences I have enabled:
    - Show the downloads window when downloading a file
    - Always ask me where to save files

    No, I just wonder, if only mods (or something) can close a topic, but ok, I see I can now click "solved it" next to your post. Seems like someone has to post something.^^

Maybe you are looking for

  • How can I prevent Firefox from automatically filling in my passward in every site I visit? I have NO security now when others use computer.

    Everytime anyone on this computer goes to my AOL or YAHOO email, Firefox automatically fills in my password and whoever is using my computer can read my email or check bank balances or anything else. I have just started using Firefox and now have NO

  • Where do I buy a replacement battery for a MacBookPro6,2

    After 1504 cycles, the "Replace Soon" warning has shown up on my mid-2010 MacBook Pro. I am 100% capable of replacing the battery myself, however I can't find anywhere on Apple's website to buy the replacement battery. All it says is to bring it in f

  • Opening email attachments

    While trying to open an attachment in an email, I asked a friend for help. He did not know jack about Mac. When the choose application window popped up, I don't know what he did, but now when I click on an attachment icon in the email, a New Message

  • Calling smartform application in ITS

    Hi all, I am workin on SRM 5.0 with integrated ITS.I have created a custom report and assigned a tcode to it as well as created an internet service for it. Now i have added the tcode for the report in my SRM roles so that it is displayed as link in t

  • Can't Disable Screensaver

    Hello, Any one ever have a problem disabling the screensaver? I have it set to never come on using the preferences pane, yet it still comes on. I have repaired permissions to no avail. Any other suggestions? Thanks Nano