Email text files through plsql procedures

Hi,
I have written a procedure that selects table data and writes a .txt file in delimitted format. After the file is created on the C drive of the server I want to attach the file in a email and send it to the recepients.
I have used the built in package and can send emails...but it goes with out the attachment...
Can anyone tell me how can i attach the .txt file in the plsql procedure that sends the email.??

user8958533 wrote:
Hi,
I have written a procedure that selects table data and writes a .txt file in delimitted format. After the file is created on the C drive of the server I want to attach the file in a email and send it to the recepients. Don't - why write data externally and then have to read that data again to use it internally?
An attachment in an e-mail is not a separate file - the file contents is part and parcel of the e-mail message body. It is a single block of data. There is no requirement for the so-call attachment to be a physical file at all. All that is needed is correctly formatting the main body (as per MIME specs).
So rather write data to a CLOB and when done, create the e-mail body and append the CLOB contents to the e-mail.
This topic has been discussed numerous times. See {message:id=3963129} and {message:id=3913513} for starters.. and consider using the search function before asking a question.

Similar Messages

  • How to compare two PDF files through PLSQL

    Hi,
    Can any body help that how to compare two PDF files through PLSQL programing and gives the differences as output.
    Thanks,

    Or simply apply an oracle text index on your pdf column:
    SQL>  create table t (id integer primary key, bl blob)
    Table created.
    SQL>  declare
    bf bfile := bfilename('TEMP','b32001.pdf');
    bl blob;
    begin
    dbms_lob.createtemporary(bl,true);
    dbms_lob.open(bf,dbms_lob.lob_readonly);
    DBMS_LOB.LOADFROMFILE(bl, bf,dbms_lob.getlength(bf));
    insert into t values (1,bl);
    commit;
    dbms_lob.close(bf);
    dbms_lob.freetemporary(bl);
    end;
    PL/SQL procedure successfully completed.
    SQL>  create index t_idx on t (bl) indextype is ctxsys.context parameters ('filter ctxsys.auto_filter')
    Index created.
    SQL>  declare
       mklob   clob;
    begin
       ctx_doc.filter ('t_idx', '1', mklob, true);
       dbms_output.put_line (substr (mklob, 1, 250));
       dbms_lob.freetemporary (mklob);
    end;
    Oracle® Database
    Release Notes
    11
    g
    Release 1 (11.1) for Linux
    B32001-04
    November 2007
    This document contains important information that was not included in the
    platform-specific or product-specific documentation
    PL/SQL procedure successfully completed.This generates a text only version of your pdf and standard text comparison methods can be applied ....

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • How to import data from a text file through DTS to Sql Server

    Please don't mistake me as i'm a new comer to sql server,please help me.
    how to import the data present in a plain text file through DTS into sql server and store the data in a temporary table.
    How far the temporary table is stored in the database.
    Please reply me as soon as possible.
    Thank you viewers.

    >
    I can say that anybody with
    no experience could easily do an export/import in
    MSSQLServer 2000.
    Anybody with no experience should not mess up my Oracle Databases !

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to read a text file through pl/sql

    How to read a text file through pl/sql

    pl/sql runs inside the database. so your file also should be on the database server file system for you to be able to read.
    check out UTL_FILE package. This is the database package to read/write files on the database server.

  • Sending EMail "Text-File" from Application Server!

    Hi Experts,
    how can I sending a Text-File from Application Server via Email?
    Is there existing a Function Modul?
    With Kind regards
    Ersin
    Moderator message: sending emails = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 25, 2010 4:23 PM

    STF (Search the forum)!  This type of question has been asked...and answered....many times.

  • How to Create a text file through Portal

    Hi,
    Is there any way to create a text file(e.g Excel file) through Portal? Thanks.
    Sumita

    I have a way to do this in VBScript, I don't know if it will work with the portal but the steps are simple. If you can create a text file within portal, try to create it as an html table:
    <table>
    <tr>
    <td>Column Header 1</td>
    <td>Column Header 2</td>
    </tr>
    <tr>
    <td>Value 1</td>
    <td>Value 2</td>
    </tr>
    <tr>
    </tr>
    </table>
    When you create this file save it with XLS extension instead of TXT, create a link to it and voila! it will load Excel and you will have your data well formatted. I found this method rather better than save the file as a CSV. You can also include any html attribute inside the <TD> or <TR> like background color and font type, Excel will keep those attributes.
    I hope this will help
    Arturo

  • Calling Batch files in PLSQL Procedure

    Hi all,
    I am working on a PLSQL procedure and having issues when I am trying to call a batch file.
    Issue:-
    I have a procedure which have to kick off a batch file. And that batch file needs to run in Windows not in Unix box. 
    Can someone please help me out in providing some samples or anything?
    Thanks a lot in advance.

    Thank you rp0428 and sb92075,
    I have tried to create a sample of what I am trying to get and so I have created the following code in a batch file and named as Check.bat:-
    @set a=3
    @set b=4
    @set /a c=%a%+%b%
    echo %c%
    So based on those links you guys provided I have created an
    Scheduler Job:-
    BEGIN
    DBMS_SCHEDULER.create_job (job_name        => 'MYJOB1',
                               job_type        => 'EXECUTABLE', JOB_ACTION      => 'c:\Check.bat', enabled         => TRUE,comments        => 'runs Check.bat' );
    END;
    And the following Procedure :-
    CREATE OR REPLACE PROCEDURE execute_bat_file
    IS
    BEGIN
       DBMS_SCHEDULER.RUN_JOB ('MYJOB1', TRUE);
    END execute_bat_file;
    And used the following exec command:-
    exec execute_bat_file;
    I am getting the following error:-
    Error starting at line 1 in command:
    exec execute_bat_file
    Error report:
    ORA-27475: "ACTUATE.MYJOB1" must be a job
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at "ACTUATE.EXECUTE_BAT_FILE", line 4
    ORA-06512: at line 1
    27475. 00000 -  "\"%s.%s\" must be a %s"
    *Cause:    An object of the wrong type was specified. For example, a table
               could have been passed to the drop_job() procedure.
    *Action:   Reissue a different command applicable to this object type or
               reissue the same command using an object of the valid type.
    Can you guys please help with this?
    Thank you once again

  • How to get tab delimited text file when Stored Procedure executes ?

    Hello Everyone,
    I have a stored procedure which returns 1 result set as an output.
    I want the output as a Tab Delimited Text file.
    I know that I can use SSIS and get the same output but I am not allowed to use SSIS in this case.
    Is there any other ways ?
    I will be really appreciate If someone can answer with, How many different ways I can get Tab delimited text file ?
    Thanks in advance
    Henary

    you can do that by using SQLCMD
    http://blog.sqlauthority.com/2013/03/05/sql-server-exporting-query-results-to-csv-using-sqlcmd/
    you can also use BCP 
    EXEC master..xp_cmdshell 'bcp "select * from tempdb.dbo.orders" queryout "c:\output.txt" -c -T'
    EXEC master..xp_cmdshell 'bcp "exec usertest.dbo.proctest" queryout "c:\output.txt" -c -T'
    --Prashanth

  • Reading text file from stored procedure

    Hi
    I have a text file coming daily. I need to read the file.
    1st line contain the file source
    Last line contain the no of records in the file.
    I need to count all the lines in text file compare with the number of lines mentioned in the last line of the file.
    Can any one help me in achieving the above task.
    Thanks a lot in advance.
    KLSRAO

    Re: UTL_FILE Examples

  • How to read a text file through BufferedReader

    I want to read a text file by BufferedReader, How can I do that? The format of the file as follows:
    NAME MAKER YEAR PRICE CONDITION
    13 Dead End Drive __ Milton Bradley 1993 $22.00 C09
    18 Wheeler Fever __ Donna Lee Ent. 1980 $20.00 C09
    how to parse the line from the file to extract the name, maker, year, price and condition.
    Thank you first.

    Look at: stream tutorials,
    BufferedReader, InputStreamReader, FileInputStream, StringTokenizer

  • Sending Text File through Mail Adapter

    Hi Group,
    I need to send my Target as Mail attachment in the Text File?Can any body Suggest

    Hi swabap,
         You need to use PayloadSwapBean module in the Mail receiver adapter. This module will send the payload as an attchment to the mail server.
    Check the following link
    <a href="/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure:///people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    Regards,
    Akshay

  • Problem while uploading text file through portal into WebDAV repository .

    Hi all...
    I am not able to upload any file through portal onto my webDav repository for remote server however reverse is possible i.e. any document created at remote server is reflected in portal.
    Everytime when i try to upload file though portal , i get the following error::
    The item could not be created because an exception occurred in the framework.
    Kindly suggest what to do....
    ThankS

    Hi Chetna,
    Have you specified any user information in the webdav repository....Like always connect through this user, in the webdav repsository tab....This user may not have write permission in the windows.
    Also are you sure that the user you logged in portal by which you failed to create new files or folders and the user that was able to create file in the windows are one and the same.....
    Regards,
    Ganesh N

  • Loading Data From a Text File Through an Application into Oracle

    Hi There,
    I have a web application that allows the user to upload a text file. This file is then processed by my application. Each line in the file is a new row I need to insert into my table.
    Currently, I batch 200 updates together and insert them into the DB.
    For about 3 million records this is taking much longer than I would like it to.
    Any suggestions for optimization?
    thanks.

    I put here a simplest demo (file has whitespace)
    I think it may help to start.
    --Structure of your file test1.dat (put in your directory)
    a1 b1
    a2 b2
    a3 b3
    a4 b4
    CREATE OR REPLACE DIRECTORY
    test_dir AS
    'C:\oraclexe\DIR' --or anywhere
    --GRANT READ, WRITE ON DIRECTORY  test_dir TO your_user
    --external table:
    DROP TABLE test_ext
    CREATE     TABLE test_ext
       (col1      CHAR(5),
        col2      CHAR(5)
    ORGANIZATION EXTERNAL
       (TYPE oracle_loader
        DEFAULT DIRECTORY test_dir
        ACCESS PARAMETERS
          (RECORDS DELIMITED BY NEWLINE
           FIELDS TERMINATED BY WHITESPACE)
           LOCATION ('test1.dat')
    SELECT * FROM test_ext
    COL1  COL2 
    a1    b1   
    a2    b2   
    a3    b3   
    a4    b4   
    Insert into another_table(another_col1, another_col2) (select col1, col2 from test_ext) if needed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • 2 instance of iTunes?  Good idea, or bad?

    I used two iTunes instances to sync calendar at work and music/applications at home. After doing this for the first time yesterday, my iPhone 3Gs did not function properly. Applications didn't load (the would just pop up a splash scren and then go ba

  • Custom Reports to Homepage

    Hello, I have created the customer reports that i wish to allocate the tabs but after i assign them to the designated role they don't automatically load on page load. It loads the following message: Generating analysis... Click here to view the resul

  • I want to toggle Movie Symbols with List boxes

    For some reason I cant seem to use remove.clip to turn off a movie symbol. I dont think I am setting this up correctly, it is an easy task I am trying to acomplish. basically I have 3 movie symbols of hair and 3 radio buttons I want to attatch them t

  • Getting the WS Remote Hostname via the PRC?

    Is there any way of programatically determining the portal's WS Server name, as defined in the .properties file used for install/upgrade? I need this when calling IRemoteSession.GetExplicitLoginContext... needed to generate the URI for the first para

  • Base64 encode decode question

    Hi I use the auclair base64 class to encode and decode base64 locally and it works great. But when I send the string to my server and back (aspx), I cannot decode it I have the 2030 error from flash. When I compare the encoded string from both end th