Utl file - I need to get new line for each value

I wrote an utl_file package to generate an html file. It is working fine, however, I am having difficulty formating my output.
I like to have values returned one line at a time. For instance,
Name:Sam Ok
area code: 407
phone: 333-4444
picture: display here.
It is displaying values on one line.
Please help if you can. Here is the code.
Thanks,
sam
CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
P_Filename IN varchar2,
p_Id IN mist_physician.mp_phys_Id%TYPE
AS
CURSOR C_mist IS
SELECT mp_name,
mp_update_datetime,
mp_area_code,
mp_phone,
mp_address,
mp_fax
FROM Mist_Physician
WHERE Mp_phys_id = P_Id;
v_mp_name mist_physician.mp_name%type;
v_mp_update_datetime mist_physician.mp_update_datetime%type;
v_mp_areacode mist_physician.mp_area_code%type;
v_phone mist_physician.mp_phone%type;
v_mp_address mist_physician.mp_address%type;
v_mp_fax mist_physician.mp_fax%type;
V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
BEGIN
--Open The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('c:\mist_info', P_FileName, 'w');
IF Utl_File.IS_OPEN(V_FileHandle) = FALSE THEN
RAISE_APPLICATION_ERROR(-20000,'Error opening '||P_FileName||' for WRITE');
END IF;
Let's build the header file that will be inside the file that will  identify why thus file is created.
utl_file.put_line(V_FileHandle,'#---------------------------------------');
utl_file.put_line(V_FileHandle,'Name'||' : '||mist_Rec.mp_name);
utl_file.put_line(V_FileHandle,'Date');
utl_file.put_line(V_FileHandle,'Phone');
utl_file.put_line(V_FileHandle,'Address');
utl_file.put_line(V_FileHandle,'# Generated on: '||to_char(sysdate, 'Mon DD, YYYY (Dy) HH:MI:SS AM'));
utl_file.put_line(V_FileHandle,'#-----------------------------------------');
utl_file.put_line(V_FileHandle,' ');
-- Next we will query data from the Movie table. Only data that are relevant.
-- Using PUT_LINE, write text with the field arguments out to the file
BEGIN
FOR Mist_Rec IN C_Mist LOOP
UTL_FILE.PUT_LINE(V_FileHandle,'Name'||':'||Mist_Rec.Mp_Name||','||'<img src=c:/our_website/co16.jpeg>');
END LOOP;
SELECT mp_name,
mp_update_datetime,
mp_area_code,
mp_phone,
mp_address,
mp_fax
INTO v_mp_name,
v_mp_update_datetime,
v_mp_areacode,
v_phone,
v_mp_address,
v_mp_fax
FROM Mist_Physician
WHERE Mp_phys_id = P_Id;
END;
-- Now Close the file
UTL_FILE.FCLOSE( V_FileHandle);
EXCEPTION
WHEN Utl_File.Invalid_Path THEN
RAISE_APPLICATION_ERROR(-20001,'Error: Invalid Path');
WHEN Utl_File.Invalid_Operation THEN
RAISE_APPLICATION_ERROR(-20002,'Error: Invalid File Operation');
IF Utl_File.IS_OPEN(V_FileHandle) = TRUE THEN
Utl_File.FCLOSE(V_FileHandle);
END IF;
WHEN Utl_File.Invalid_Mode THEN
RAISE_APPLICATION_ERROR(-20003,'Error: Invalid Mode');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLCODE || '-'||SQLERRM);
END Cr_Movie_PRV_HTML;
/**********************End Of Mist*********************/

Syntax is::
UTL_FILE.NEW_LINE(filename, nuber-of-lines)
CREATE OR REPLACE PROCEDURE Cr_Movie_PRV_HTML(
P_Filename IN varchar2,
p_Id IN mist_physician.mp_phys_Id%TYPE
AS
CURSOR C_mist IS
SELECT mp_name,
mp_update_datetime,
mp_area_code,
mp_phone,
mp_address,
mp_fax
FROM Mist_Physician
WHERE Mp_phys_id = P_Id;
v_mp_name mist_physician.mp_name%type;
v_mp_update_datetime mist_physician.mp_update_datetime%type;
v_mp_areacode mist_physician.mp_area_code%type;
v_phone mist_physician.mp_phone%type;
v_mp_address mist_physician.mp_address%type;
v_mp_fax mist_physician.mp_fax%type;
V_FileHandle UTL_FILE.FILE_TYPE; -- This will be used to store the filename
BEGIN
--Open The specified file to write into and get V_FileHandle.
V_FileHandle := UTL_FILE.FOPEN('c:\mist_info', P_FileName, 'w');
IF Utl_File.IS_OPEN(V_FileHandle) = FALSE THEN
RAISE_APPLICATION_ERROR(-20000,'Error opening '||P_FileName||' for WRITE');
END IF;
utl_file.put_line(V_FileHandle,' ');
-- Next we will query data from the Movie table. Only data that are relevant.
-- Using PUT_LINE, write text with the field arguments out to the file
BEGIN
FOR Mist_Rec IN C_Mist LOOP
--Let's build the header file that will be inside the file that will
--identify why thus file is created.
UTL_FILE.PUTF
(file_handle, %s,'--------------------------');
UTL_FILE.NEW_LINE(V_FileHandle, 1)
UTL_FILE.PUTF (file_handle, '%s','Name'||':'||Mist_Rec.Mp_Name, )
UTL_FILE.NEW_LINE(V_FileHandle, 1)
.(Chang the below all u will get as u required)
'Date'||' : '||Mist_Rec.mp_update_datetime,
'Area Code'||' : '||Mist_Rec.mp_area_code,
'Phone'||' : '||Mist_Rec.mp_phone,
'Address'||' : '||Mist_Rec.mp_address,
'Fax'||' : '||Mist_Rec.mp_fax,
'# Generated on: '||to_char(sysdate, 'Mon DD,
YYYY (Dy) HH:MI:SS AM')),
'<img src=c:/our_website/co16.jpeg>'),
-- UTL_FILE.PUT_LINE(V_FileHandle,'Name'||':'||Mist_Rec.Mp_Name||','||'<img
--src=c:/our_website/co16.jpeg>');
END LOOP;
SELECT mp_name,
mp_update_datetime,
mp_area_code,
mp_phone,
mp_address,
mp_fax
INTO v_mp_name,
v_mp_update_datetime,
v_mp_areacode,
v_phone,
v_mp_address,
v_mp_fax
FROM Mist_Physician
WHERE Mp_phys_id = P_Id;
END;
-- Now Close the file
UTL_FILE.FCLOSE( V_FileHandle);
EXCEPTION
WHEN Utl_File.Invalid_Path THEN
RAISE_APPLICATION_ERROR(-20001,'Error: Invalid Path');
WHEN Utl_File.Invalid_Operation THEN
RAISE_APPLICATION_ERROR(-20002,'Error: Invalid File Operation');
IF Utl_File.IS_OPEN(V_FileHandle) = TRUE THEN
Utl_File.FCLOSE(V_FileHandle);
END IF;
WHEN Utl_File.Invalid_Mode THEN
RAISE_APPLICATION_ERROR(-20003,'Error: Invalid Mode');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR: ' || SQLCODE || '-'||SQLERRM);
END Cr_Movie_PRV_HTML;
/**********************End Of Mist*********************/

Similar Messages

  • Set to new line for each label/text combination ?

    Dear All,
    Wish to enquire how to set to next line for each label/text combination in relation to the following code ? Please advise.
    import java.awt.*;
    public class ScanImageForm {
    public static void main(String args[]) {
         ScanImageForm scanImageForm = new ScanImageForm();
         scanImageForm.Display();
    public void Display() {
         Frame frame = new Frame();
         Panel panel = new Panel();
         frame.add(panel);
         Label labelVehNo = new Label("Vehicle No:");
         Label labelDateofLoss = new Label("Date of Loss:");
         Label labelImageType = new Label("Image Type:");
         Label labelImageDesc = new Label("Image Desc:");
         TextField textVehNo = new TextField();
         TextField textDateofLoss = new TextField();
         TextField textImageType = new TextField();
         TextField textImageDesc = new TextField();
         textVehNo.setColumns(10);          
         textDateofLoss.setColumns(10);
         textImageType.setColumns(10);
         textImageDesc.setColumns(30);
         panel.add(labelVehNo, BorderLayout.WEST);
         panel.add(textVehNo, BorderLayout.CENTER);
         panel.add(labelDateofLoss, BorderLayout.WEST);
         panel.add(textDateofLoss, BorderLayout.CENTER);
         panel.add(labelImageType, BorderLayout.WEST);
         panel.add(textImageType, BorderLayout.CENTER);
         panel.add(labelImageDesc, BorderLayout.WEST);
         panel.add(textImageDesc, BorderLayout.CENTER);
         frame.setSize(500, 500);
         frame.setVisible(true);

    if u want to set label and textfield side by side .
    then u have to set The layout is GridLayout().
    to ur example
    Panel p=new Panel(new GridaLayout(3,2))
    means three rows to columns.

  • New line for each segment for Inhouse files using bic mapping..!!

    Hi ,
    Idoc to File scenario.
    In the receiver adapter, we need to convert the XML into file(Inhouse format) by using seeburger mapping.
    We have generated the map for this in bic and used in Module configuration of receiver adapter.
    Now the question is I need to get each segment of XML file into a separate line in the output file like below.
    HDR ... ......
    DTL .........
    DTL ........
    where HDR is the header and DTL is the details segments.
    Iam getting the output in a single line like HDR.........DTL.........DTL.........
    but not as expected like above  .
    I tried by using newLine = true in module configuration, but no use.
    I digged into bic designer to search for any option , but no use.
    Kindly suggest me if any one has any idea on this.
    Thanks&Regards'
    Deepthi.

    Hi Deepthi,
        Did you find the solution, please let me now if you get.
    did you mention the below code to solve the issue.
    copy the below section in the NewMapping Program:
       SetDestinationDelimiter("SubElement", ">");
       SetDestinationDelimiter("Element", "~");
       SetDestinationDelimiter("Segment", "\n");
    Regards,
    Varun Reddy.K

  • Is there a way to get the details for each hit in the portal database WCR_WEBCONTENTSTAT?

    Hi,
    I need to get the details for each user hit.
    Apparently, this table has the IMPRESSIONS column which returns the total number of hitcounts and VISITS which counts the number of unique user who accesses the portal. What I am trying to look for is to get all the details per hitcount. I need to find out how many time a specific user accessed a specific page or iview.
    I also used the table WCR_USERPAGEUSAGE, which I get the information of the users counted in the VISITS column in the first table.
    I could not get the specific user per hit.
    Please enlighten me if this is possible and how to do this?
    Thanks!

    Hi Catherine,
    Why not use the portal activity report iView?
    In the portal activity report iView the 3rd option allows you to choose a page for example and see
    the user who accessed it and how many times.
    Thanks and BR,
    Saar

  • Do I need to create new group for standby redo log files?

    I have 10 group of redo log files with 2 members for each group for my primary database , Do I need to create new group for standby redo log files for the standby database
    Group#     Members
    ==============
    1              2
    2              2
    3             2
    4             2
    5             2
    6             2
    7             2
    8             2
    9             2
    10           2
    If So, The following statment is correct? or nto
    ALTER DATABASE ADD STANDBY LOGFILE GROUP 1 ('D:\Databases\epprod\StandbyRedoLog\REDO01.LOG',D:\Databases\epprod\StandbyRedoLog\REDO01_1.LOG');
    please correct me if am doin mistake
    becuase when I issue the statment I getting error message sayin the group is already created.

    Thanks John
    I just find the answer
    Yes, it's recomeded to add new group , for instnace If I have 10 group from 1 to 10 then the standby shoudl be from 11 to 20
    Thanks I found the answer.

  • Hard drive died.  Need to reinstall on new laptop with windows 7 64 bit system,  Need to get activation code for CS3 Web Premium.

    Hard drive died.  Cannot uninstall CS3 to remove copy registration. Need to reinstall on new laptop with windows 7 64 bit system,  Need to get activation code for CS3 Web Premium.

    Thank you Bob.
    Just to clarify - in terms of backing up one set of these, would that just be so I had it on disk and didn't need to re-download from Adobe if the installation got corrupted somehow?  Or do I need a backup for some other reason?
    Thanks

  • I need help getting new authorization codes for digital copies

    I need help getting new authorization codes for digital copies of movies. Can someone help me out?

    There's a lot of results in Google when you search for this but unfortunately refreshing the page doesn't seem to generate a different code anymore. Mine also says already redeemed

  • Need help getting new printer hp deskjet 3520 setup for eprint and wireless

    need help getting new printer hp deskjet 23520 stup for eprint and wireless

    Hi Pastorlee7,
    I see that you're having problems setting up your printer.  I would take a look at the document below.
    Hp deskjet 3520
    Let me know how it goes.  

  • Need to print new line when "," in string

    Hi,
    I have a string having value 12,221,23,67...
    I need to print a new line after ", "
    i;e 12
    221
    23
    67....
    Please suggest.
    Thanks,
    Ajit

    Hi Team ,
    its done.
    I have used chr 13, chr10 and it print new lines for me
    v_serial_num:=v_serial_num||','||CHR(13) || CHR(10)||rec.SERIAL_NUMBER;
    Thanks,
    Ajit

  • How to get the texts for each line item for Sales order in a smartform

    I'm createing a smart form in which i need to display certain texts for each line item of a sales order. How can i get those??
    I'm trying with the table STXH and FM read_text... but i'm not clear how and what i'm getting... can anybody pls help me.....

    Hi There,
    But then i will be getting only the value. i want to link that against the particular material of the Purchase Order.
    Like for ex:
    PO No.  Material Code        Line Item        Basic        Excise       Tax       Inv Value
    0000001 5000251                010               100           16         4.64      120.64
    0000001 5000252                020               200           32         9.28      241.28
    Can u help me on this?
    Regards,
    Jitesh

  • Inserting a new line after each tag of an xml

    Hi,
    I am having a requirement where i need to insert a newline after each tag<> of an xml. I am sending an xml to target system using JMS adapter and the target system has UNIX as OS.
    In unix system if we see the output xml, it will be in a single string as shown
    <?xml version="1.0" encoding="ISO-8859-1"?><messages><Field1\><Field2\>.........................</messages>
    But the desired output should be in the below format
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <messages>
    <Field1\>
    <Field2\>
    </messages>
    And there should not be any indentation for the xml. It should be in the above format it self.

    Hi,
    I believe this can be achieved through XSLT or JAVA Mapping.
    Please refer to the following link:
    XSLT Mapping:
    Inserting a new line after each tag of an xml
    JAVA Mapping:
    In Java Mapping ,all you have to do is to make a code that does a search and replace.
    Hope this helps,

  • I need to get raw plugin for Canon 5D Mark iii for CS6  the adobe website has changed and I can not find the download.. it keeps looping me back to the product download

    I need to get raw plugin for Canon 5D Mark iii for CS6  the adobe website has changed and I can not find the download.. it keeps looping me back to the product download page without the raw

    Which operating system are you using?
    Have you tried Help>Updates from within photoshop cs6 to get either camera raw 8.3 or 8.7.1, which should enable photoshop cs6 to open the canon 5D Mark III files.
    (version of camera raw depends on your operating system)
    If that doesn't work try one of the following camera raw plugin installers:
    Camera raw 8.7.1 plugin
    https://helpx.adobe.com/x-productkb/multi/camera-raw-plug-in-installer.html
    If you have windows xp or vista or mac os x snow leopard (10.6.8), then you'll have to use the camera raw 8.3 plugin installer:
    https://helpx.adobe.com/x-productkb/multi/camera-raw-84-support-policy.html

  • I have a form that has multiple fields but has 5 sections. I have used mail merge to insert information but I can't get Excel to recognize that I need different names and addresses for each section. Please help.

    I have a form that has multiple fields but has 5 sections. I have used mail merge to insert information but I can't get Excel to recognize that I need different names and addresses for each section. Please help.

    Thanks for your response. I do believe I have the information needed for each form on a separate line in Excel. There is a first name, middle name, last name, city, and zip column. And field is entered on a different line for all the information. I'm really stuck.

  • HT5449 Cannot Dictate "New Line" for a return key stroke.

    When using dictation I can't get "New Line" to work. It simply types this phrase! The "New Paragraph" command works, but adds all these additional spaces into my text. Has anybody got ideas on how to resolve? Is there another way to dictate a "return key"?

    I understand.
    Perhaps Apple Support in Australia would be willing to answer that one for you.  Their phone number is:
    (61) 1-300-321-456
    Or I wonder if there is some term used in Australia that means "new line" that might work (such as "return").  "Return" does not generate a new line here.

  • My iphone serial number claims to have been replaced. But it is actually not. I need to get it replaced for a screen issue ASAP! Please help

    My iphone serial number claims to have been replaced. But it is actually not. I need to get it replaced for a screen issue ASAP! Please help

    This was told to me by Apple Store reps... They have asked to contact Apple support help line .. nobody answers there.. I am stuck! There is no email id that i can find either to contact Apple support

Maybe you are looking for

  • MessageBroker.getMessageBroker(null) returns null.. why?

    Hello I have seen lot of posts regarding this but no clear reason why this would happen. My server runs under Tomcat 6.0.33. In a spearate thread, I try to get MessageBroker msgBroker = MessageBroker.getMessageBroker(null); but it always returns null

  • How to Import Multiple Image Sequences into - Premiere 'Pro'

    Hi ;-) 1) I added a bug report about this 4 years ago  -- Is this STILL not possible ;-)))) I have 200 Sequences sitting each in its own folder. As of now - then year of the Lord 2014, I have to physically select each folder and add them one by one..

  • Oracle 10.2 on AIX 6.1

    Hi all, I have to install oracle 10.2 on AIX 6.1 , first I installed 10.2.0.1 and after I upgraded it to 10.2.0.3. I forgot to run the patch 6613550 before installing (10.2.0.1) and upgrading to 10.2.0.3. Should I recommence the installation from scr

  • Saving docs in iCloud

    Is there a way to save a pages document to both iCloud and  my macbook pro - for when I'm not online. Thanks for any Help   Cheers, David

  • Reorganizing Events in my Events Library

    I am studying the iMovie '11 Help to figure out *how to re-organize my Events Library*. One lesson is How to move a clip from one Event to another. It says: +To move video clips from one Event to another:+ +In the Event Library, click to select the E