Print using UTL_FILE

I want to create a function that would return number or boolean type in case of success or failure of file not found at a path. File is a gif image.
Here is my code. Please help.
create or replace function ufile3 (fname varchar2,loc varchar2) return Number As
fhandle utl_file.file_type;
op varchar2(3);
success boolean;
begin
op := 'a';
fhandle := UTL_FILE.FOPEN(loc,fname,'r');
UTL_FILE.Fclose(fhandle);
If True then
return(1);
else
return(0);
end if;
Exception
WHEN utl_file.invalid_path then
dbms_output.put_line ('Invalid Path');
return(0);
WHEN utl_file.invalid_mode then
dbms_output.put_line ('Invalid mode');
return(0);
WHEN utl_file.invalid_operation then
dbms_output.put_line ('Invalid operation');
return(0);
when others then
dbms_output.put_line('Unhandled Error : '||sqlcode);
dbms_output.put_line(sqlerrm);
utl_file.fclose(FHANDLE);
return(0);
End;

Have a look at the 'other' functions within UTL_FILE...
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#i1003488

Similar Messages

  • Problem printing simplified Chinese on PM4i printer using multi-byte data

    I am new to printing data in Simplified Chinese and have tried for a period of time to get it to work but it is not working. I would appreciate any help.
    This is what I have:
    1. Chinese data stored as multi-byte data in oracle 10g db. It is in one of the attribute fields on the mtl_system_items table. The data field it is stored in is defined as varchar2(240). I have to extract that data and print it out as simplified Chinese characters on 3x4 label stock on PM4i printer which is setup to use IPL as the default language.
    2. Purchased the simplified Chinese font kit ( compact flash card ) and plugged it into the compact flash port on back of the printer. The simplified Chinese font is assigned.
    3. Created simple program to build the label file to send to the printer to print the Chinese glyphs. I expected 3 to print but it only prints 1 Chinese glyph and that is not the correct.
    a. Data shown in Chinese
    传感器
    b. Data in hex format => E4BCA0E6849FE599A8
    c. Data in utf8 => ä¼ æ„Ÿå™¨
    d. Simple oracle pl/sql program code to extract data from oracle and create the format file for printing
    CREATE OR REPLACE PROCEDURE china_test_label1 is
    hold_length number;
    v_hold_armpart varchar2(240):= null;
    v_hold_line varchar2(500);
    v_file_name varchar2(100) := 'chlabel1.txt';
    v_file_line1 varchar2(100) := '<STX><ESC>C<ETX>';
    v_file_line2 varchar2(100) := '<STX><ESC>P<ETX>';
    v_file_line3 varchar2(100) := '<STX>E4;F4;<ETX>';
    v_file_line4 varchar2(100) := '<STX>H00;o0200,0200;c60;k32;d0,30;<ETX>';
    v_file_line5 varchar2(100) := '<STX>L1;o102,102;f0;l575;w5;<ETX>';
    v_file_line6 varchar2(100) := '<STX>R<ETX>';
    v_file_line7 varchar2(100) := '<STX><ESC>E4<CAN><ETX>';
    v_file_line8 varchar2(100) := '<STX><ETB><ETX>';
    v_file_line varchar2(500);
    v_file_handle UTL_FILE.file_type;
    v_submit_status number;
    v_out_path_name varchar2(50);
    v_export_path_name varchar2(50);
    -- Program Starts Here
    BEGIN
    fnd_file.put_line(fnd_file.log, '------- Starting Label job -------');
    SELECT description
    INTO v_out_path_name
    FROM fnd_lookup_values
    WHERE lookup_type = 'ARM_DATA_FILE_OUT_PATH'
    AND lookup_code = '$FLMARM_TOP';
    v_file_handle := utl_file.fopen(v_out_path_name, v_file_name, 'W');
    v_file_line := v_file_line1;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line2;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line3;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line4;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line5;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line6;
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line7;
    utl_file.put_line(v_file_handle, v_file_line);
    BEGIN
    select attribute13
    INTO v_hold_armpart
    FROM apps.mtl_system_items
    WHERE segment1 = '20928536'
    AND organization_id = 282;
    EXCEPTION
    WHEN others THEN
    v_hold_armpart := 'nothing';
    END;
    v_file_line := '<STX>'||v_hold_armpart||'<CR><ETX>';
    utl_file.put_line(v_file_handle, v_file_line);
    v_file_line := v_file_line8;
    utl_file.put_line(v_file_handle, v_file_line);
    utl_file.fclose(v_file_handle);
    fnd_file.put_line(fnd_file.log, '-------------------------------------------');
    fnd_file.put_line(fnd_file.log, '-- end of job ');
    fnd_file.put_line(fnd_file.log, '-------------------------------------------');
    END china_test_label1;
    show errors;
    e. i do lpr -P printer filename to print the file. here is the file contents :
    <STX><ESC>C<ETX>
    <STX><ESC>P<ETX>
    <STX>E4;F4;<ETX>
    <STX>H00;o0200,0200;c60;k32;d0,30;<ETX>
    <STX>L1;o102,102;f0;l575;w5;<ETX>
    <STX>R<ETX>
    <STX><ESC>E4<CAN><ETX>
    <STX>ä¼ æ„Ÿå™¨<CR><ETX>
    <STX><ETB><ETX>
    i think the issue here may be with formating the mulit-byte data into format it can be printed using the c60 font. Any
    coding examples would be greatly appreciated

    Hi,
    Welcome you post on the forum.
    However, this is not the right forum for you. It is only for SAP Business One user. Please search entire forums first to find which one is more proper.
    However, this issue may not be related to SAP at all. Search on the web would be better.
    Thanks,
    Gordon

  • Load from EBCDIC file to Oracle 9i tables using UTL_FILE

    Hello, I have a requirement to load EBCDIC file from Mainframe to load to Oracle 9i tables and then do some transformation. Then again create EBCDIC file from database table. I'm not sure if this is possible using UTL_FILE, though i have seen people loading using SQL * Loader. If possible, can you please give some sample code for this? I would appreciate your help
    Thanks
    Karuna

    Hi,
    I'm reading data from EBCDIC file in Oracle PL/SQL using UTL_FILE. I wasn't able to read BINARY data type from EBCDIC to Oracle. Initially i thought the problem was due to the following reasons discussed in the article.
    http://support.sas.com/techsup/technote/ts642.html
    <quote>
    Solutions
    The only way to overcome the problem of non-standard numeric data being corrupted by the FTP is to move the data without translating it. This will necessitate making some significant changes in your program. It may also require preprocessing the data file on the mainframe. The sections below list the different types of files and situations, a recommended approach to read in the file, and a sample program to accomplish the task.
    </quote>
    But we have confirmed that the contents of EBCDIC file is fine by looking into the EBCDIC file using a tool that will convert EBCDIC to ASCII. The contents are absolutely ok.
    Now how do i read the Binary data from EBCDIC file.
    My code is like this...
    Open the file using UTL_FILE.FOPEN
    UTL_FILE.GET_LINE(file_handler,string,lengthofthestring)
    DBMS_OUTPUT.PUT_LINE(SUBSTR(CONVERT(string,ASCIIUS7,EBCDIC),1,4));
    --This is generating an output as "&". The actual data is
    --005. Since this is
    --declared as binary in EBCDIC file, I'm unable to read
    --and print it.
    --same is the case with other binary data types.
    --I'm able to read the other datatypes clearly
    UTL_FILE.FCLOSE.
    How do I resolve this? I would appreciate your help on this. This is something critical and immediate requirement for us.
    Thanks
    Karuna

  • How to suppress extra form feed for character report printing using ORARRP?

    Dear All,
    We are using Oracle Application Server 10g (10.1.2.0.2) on Windows 2003 Server and most of our client PC's are Windows XP Professional machines. We are migrating our existing oracle application from 2-tier architecture to 3-tier architecture (6i to 10g). We have installed ORARRP utility for remote direct printing and to a limited extent we are successfull in getting the things work out for our system users, However, we are facing a problem using the ORARRP utility for which we are not able to find a solution till date.
    We have configured ORARRP utility on every user's PC and the printing of bitmap reports is working well. However, while printing CHARACTER reports using ORARRP utility, after the report gets printed, an EXTRA FORM FEED is issued by ORARRP to the printer and because of this the printer stationary skips one extra page and advances to the next page. Please note that this EXTRA FORM FEED happens only while printing a CHARACTER REPORT.
    Has anyone come across such a problem using ORARRP ? How can we avoid this extra FORM FEED from CHARACTER REPORT printing using ORARRP ? Is there any other tool which supports remote direct printing just like ORARRP?
    I shall be highly obliged if anyone could reply to my queries ASAP.
    Regards,
    KrishnaKumar S

    Please help ! I tried the "send_form_feed" and "postscript_dos_print" parameters without success. The extra form feed is always there. Thanks.

  • HP Deskjet 3550 cannot print using Airport Extreme via USB connection on Windows 7 64 bits

    Product Name and Number: HP Deskjet 3550 Inkjet Printer
    Operating System installed: Windows 7 Home Premium 64 bits
    Error message: None
    Any changes made to your system before the issue occurred: Setting up HP printer using Airport Utility to add a new printer and installed Bonjour Print Wizard.
    Problem: My printer is already set up using Airport Utility. When I print something, the printer doesn't do anything. Is there something I haven't done lately in order to get this printer working using my wifi router?
    Suggestion #1: Are the print jobs getting stuck in the print queue? You can check this by clicking on the printer icon in your task tray by the clock.
    Error Message #1: Yes, the print job got stuck in the print queue, but the moment, it disappeared from the print queue and the printer doesn't print at all. This is frustrating.
    Suggestion #2: Does the printer work as expected if you connect it directly to the PC via USB?
    Error Message #2: Yes, the printer works if I connect it directly to my PC via USB, but I don't understand why it wouldn't work with the wifi router, though.
    Suggestion #3: This has to do with the way the router handles the connection to the printer. I found another thread, regarding this issue, and it has some information that may help resolve it.
    http://h30434.www3.hp.com/t5/Printer-Networking-and-Wireless/Print-Problem-Using -USB-Printer-on-Airp...
    If that does not help, I would recommend posting on the Apple forums, as they may have more expertise with the router's abilities:
    https://discussions.apple.com/community/wireless/airport
    Error Message #3: After clicking on the first link that you posted, it was very helpful, but the printer couldn't print completely and somehow it would stop at the quarter of a paper. It looks incomplete when I took it out from my printer. It does that every time.

    UPDATE!
    Problem solved!  So this is just a followup in case someone else ever stumbles into these boards with the same or similar problems as mine, that is, trying to run an HP Deskjet D1500 series printer [mine's a D1520] on an Airport Extreme wifi router's USB port as a network printer [with the Airport Extreme controlled by an ancient G4 PowerMac Quicksilver currently running OS X 10.4.11).
    Although it probably SHOULDN'T matter, since this type of printer works fine with just the Tricolor cartridge as shipped when hooked up directly to a computer's USB port, on a hunch I got a black HP cartridge (that's a type 21, not type 22 as I had earlier said), slapped it in, tried a test page, and all's well.  So, we can call off the technoid hounds.  Everything running perfectly.
    I hope this message in a bottle may help someone else out there some day soon who may be scratching his or her head with a similar stumper.  And just to recap those important Windows printer settings, they are:
    * [Printer Properties--> Ports--> Add New Port...] "Standard TCP/IP Port"
    * [Configure Port] IP Address "10.0.1.1" and Port "9100"
    Best of luck!
    Bilgey

  • PhotoSmart 310a doesn't print using wireless connection

    First... I have to say that if I had known what a HUGE pain in the butt this printer was I would never have bought it.  On top of that, the thing apparently doesn't have an option to "hard wire" connect it to my computer... which the guy at the store didn't bother to point out.  On top of that HP's customer service is, apparently, non-existent, as attempts to reach by phone are useless.
    They can't even seem to get the model number on the machine where you can find it... so the instructions on "how to find your model number" are useless.
    That said... here is my problem... which if I can't fix, I'm simply returning this and getting something else.
    I have my printer all set up.  Wireless is set up.  ePrint is set up.  Test pages print fine.
    I have actually been successful printing with it ONE time.... so I know that it can do it.
    It does give me a "low signal" message - however it seems to have no problem printing using the email option, or downloading from the web for the "reports."   It scans and my laptop "sees" the scanned image, which is transmitted over the wireless network.   If it is truly a low signal problem it seems like it would have issues with other functions regarding the internet.  
    BUT... when I send something from my laptop (MacBook OSX 10.5.8) to the printer it says...
    .. connecting
    .. idle
    .. priinting (%)
    .. then the print job disappears from the queue in the dialog box ... yet nothing actually prints out.
    .. it then say's "Printer Ready" - I guess ready for another print job that it won't perform.
    .. It does NOT give any kind of error code... say it's "paused" or anything like that.  It's as if it THINKS it is printing... but it does not.  It makes no sound like it's trying to print either.  Paper is loaded in fine and it will print test pages with no problem and doesn't indicate any problems on those other than "low signal"
    ... When I use the "printer utility" to print a test page - also goes wireless - it prints just fine.
    I've tried to use this printer only 4 times now for various jobs... and each time has been an ordeal lasting from 30 minutes to several hours.    I've managed to get it to print on one occasion... though I can not remember how I did it.
    It has NO problem printing from an email... so I guess I could just always do it that way... but it involves several extra steps to do so and I'm not even sure it would work for every type of print job I need.
    It works fine scanning
    It works fine photocoping
    It works fine printing from ePrint (email)
    It just DOES not print via the wireless connection
    I don't understand how a company can make something this sophisticated and not have it give you an ERROR CODE when it fails to complete a function... and frankly, I'm fed up with this thing.  It's a big, oversized, shiny paperweight and I've wasted way too much of my time trying to figure it out.  This is one last ditch effort.
    Can anyone help?    THANKS so much if you can!
    Sue

    It is more likely a network problem, so please tell me about your network - router brand/model, encryption type (WEP, WPA, etc) and ISP type (DSL, Cable, etc).
    In the mean time, you could try this quick trick; resetting the printing system:
    - Sys Prefs, Print & Fax
    - Right (control) click in the rectangle listing your printers and select Reset Printing System.
    WARNING - this will delete ALL of your printers!
    - Select the plus sign to re-add it. Look for the printer, select it and wait until the "Add" button becomes available. Click it.
    Oh, and indeed this printer does have a USB port for connection directly to your computer.  It does NOT have an Ethernet port for connection directly to your router.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • Unable print scheduled report on network printer using BOEXI 3.0

    Hi,
    I'm unable to print a scheduled report on network printer using BOE XI 3.0. I get the following error
    Error Message: Error in File ~ce6a054be1a25b52.rpt: Request cancelled by the user. ]
    Has anyone encountered this kind of problem and know what the solution is?
    Thanks,

    Hey Falk,
    Thanks for the response.
    I can print on a network printer after I changed 'Crystal Reports Job Server' to run under a user account that has privileges to access the printer.
    To answer your questions regarding the problem:
    >Can you schedule the report successfully ?
    >>Yes I was able to schedule the report successfully
    >Can you print the report successfully?
    >>NO the scheduled task would fail with the error message as posted above.
    Thanks,

  • Crystal report printing using epson dot matrix printer (continouos paper)

    Hi there, im tiff from the philippines.
    i have a  question on printing using a crystal report. How do i print using epson continuous printer(dot matrix)? im having a problem printing to that type of printer specially using continuous paper. the first page is correct but unfortunately the succeeding pages are not. its automatically adjusted upon reaching the second page. hope you can help me.
    thanks a lot and looking forward to hear from you soon.
    tiff

    Check with the printer manufacturer that the matrix printer is Unicode compliant. If it is not, it will  not work with Crystal Reports. If it is, make sure you have the latest printer driver updates.
    Download SP 1 for CR 102 from here;
    https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe
    See the following resources re. printers;
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a09051e9-721e-2b10-11b6-f9c65c64ef29
    [Note #1314394|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    Ludek

  • How many lines we can print using Non-alv report list ?

    Hi Experts,
    How many lines we can print using Non-alv report list ?
    regards
    vishnu

    Hi,
    It depends on the page size according to the page size we can set the no. of lines as follows,
    REPORT  program_name   NO STANDARD PAGE HEADING
    LINE-SIZE 290
    LINE-COUNT 65.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • On MacBook Pro unable to print webpage; I get a single blank page. But I can print using Safari. Started last week while using Firefox 3.6. I downloaded Firefox 5.0--same problem.

    On MacBook Pro unable to print webpage; I get a single blank page. But I can print using Safari. Started last week while using Firefox 3.6. I downloaded Firefox 5.0--same problem.

    I am now able to do live broadcasts with my i-sight, but my original problem still exisits....
    Unsolved Problem:I need to be able to broadcast from CamTwist as CamTwist is the only program that will allow me to do what I need to do.   Justin.tv and Ustream.tv do not recognize CamTwist for reasons I can not explain.

  • Label Printing Using Address Book - How can I Print multiple labels of the same name?

    Label Printing Using Address Book - How can I Print multiple labels of the same name?

    I used to be able to print multiple copies of the same picture on one page using iphoto. There was a customise button when you went through to print and it was there somewhere. I can't see it anymore - maybe since an upgrade.
    It's gone. But as a work-around, duplicate your photo (⌘D) to create as many versions as you want copies and select all at once. Then use the "Custom" print layout and set the photo size you want.
    After printing, trash the added versions.

  • How do I use UTL_FILE to insert a large number of fields to a file?

    Hi
    I am trying to use UTL_FILE for the first time in a Stored Procedure. I need to run a complex query to select 50 fields from various tables. I need these to be inserted into one line in the output file for all rows. Is this possible? My procedure so far is like the following
    CREATE OR REPLACE PROCEDURE PROC_TEST IS
    output_file UTL_FILE.FILE_TYPE;
    BEGIN
    FOR query in (SELECT FIELD1, FIELD2, ..........FIELD50)
    FROM TABLE A, TABLE B
    WHERE A.ID = B.ID
    ETC
    LOOP
    UTL_FILE.PUT_LINE(output_file, <put all 50 fields for all records into file> );
    END LOOP;               
    UTL_FILE.FCLOSE (output_file);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    WHEN OTHERS THEN
         UTL_FILE.FCLOSE_ALL;
    RAISE;
    END PROC_TEST;
    Do I need to define 'query' (after the FOR) anywhere, also please advise with how I put all of the fields into the file.
    Thanks
    GB

    Thanks Steve,
    I have the UTL_FILE working fine now.
    I have other queries to run and conditions to apply in the same procedure, and I need to schedule via Enterprise Manager, therefore using UTL_FILE in a procedure seemed the best option. I looked up Data-pump but this seems to be an 11g feature, and we are still on 10g therefore I will not be able to use it.
    Thanks for your help.
    GB

  • I want to set up my Epson printer using an airport and RR router. It was previously set up using a different router through HTC but same printer. How do I do this?

    I want to set up my Epson printer using an Airport and RR router. The same Mac Book and printer was formerly set up using a HTC router. How do I reset computer so it communicates with printer?

    http://support.apple.com/kb/HT3771
    Mac 101: Printing (Mac OS X v10.6)

  • How can I print using only black with the Lexmark Z810?

    Mac OS X 10.6.8
    Print Using 810 Series driver
    Printer Driver Version: 10.6.4
    I want to print using only the black cartridge.  I'm out of color ink.  However, I see no option to print using black only.  Consequently, when I print a document, only the parts of it that are black with show up on the paper.  Anything that has another color will not appear on the page.  Is there a solution to this problem?

    Print Options can be hard to find and sometimes seem to change locations depending on OSX version or printer model.  Here is where it is on the print dialog on my mini with HP printer.

  • Can't print wirelessly with HP 7410 printer using Airport Extreme

    I've got 3 Macs (2 laptops, one desktop) that I was using successfully with my wireless HP 7410 all in one printer using my old Airport Base (snow) Station (822 b & g). Just upgraded for a variety of reasons to the new Airport Extreme Base station and I have NOT been able to get the printer to print wirelessly.
    I have tried all available normal methods, including, but not limited to:
    1) resetting and restarting the printer and computer
    2) installing new printer software, including driver
    3) deleting and reinstalling printers using the "print and fax" system preference
    4) using the printer on a non-secure network
    5) setting up the printer to connect via IPP and LPP
    The end result of all of this is that the printer is attached to the network, but the computer (any of the 3) cannot connect to the printer. When I run the HP setup assistant, it cannot "find" the printer.
    Everything was working perfectly before I "upgraded." Why am I not able to print with the new base station?
    Your help would be greatly appreciated.

    I have the same proble trying to print. I have a Mac and 2 PC laptops. I tried to print to three different printers and it will not work. I called Apple support and I was told that it was set up and configured correctly, that it ust be my firewall blocking the printer. I'm at a loss after $179.00 and three hours of trying to get it to work.

Maybe you are looking for

  • Production Report - Reference BOM, PO BOM and Actual Consumption

    Hi everyone, I´m looking for some standard report that shows the quantity and cost based on the Bill of Material and the actual quantity consumed in Production Order. When the production order is created, the BOM is copied to the order, but the mater

  • Default vendor is coming in J1IG transaction while capturing excise invoice

    Hi, While capturing excise invoice at depot by using J1IG transaction, i am getting default custom vendor automatically. This is for STO transfer i am capturing excise. I have maintained some other custom vendor in the p.o. Pls. let me know from wher

  • Apple Care replaced my dead, out-out-of-warranty Airport Express

    Today, I became one of the hundreds (thousands??) of Airport Express users whose AE died just a few months out of warranty. I faithfully purchase Apple Care (3-year extended warranty) from Apple for every Mac I buy. A few years ago, my graphite Airpo

  • How do I uninstall Safari 4?

    I need to uninstall Safari 4 and reload Safari 3. Mail has stopped working the moment it was installed. This is in a work environment, where we connect to an Exchange Server. When I installed Safari 4 Beta I had to uninstall it because it would make

  • The iphone could not be sycned because the sync session failed to start

    I usually have no problems with my iphone or mac, and can sync everything fine. But randomly today i tryed to sync some photos etc and it came up with this: The iphone '_______ iphone' could not be synced because the sync session failed to start