Generation of fully automated reports and email

I'm trying to get a report (of a query) runs automatically every Tuesday morning.

It's my job
BEGIN
     dbms_scheduler.create_job (
          job_name          => 'GEN_XLS_RPT_AND_EMAIL',
          job_type          => 'STORED_PROCEDURE',
          job_action          => 'gen_bomreport_proc',
          start_date          => to_timestamp('05-12-2009 07:00','DD/MM/YYYY HH24:MI'),
          repeat_interval     => 'FREQ=DAILY; BYDAY=TUE; BYHOUR=7',
          enabled               => true,
          comments          => 'Weekly CSV Reports Output at 7:00AM'
     );
END;
Then I have a procedure
PROCEDURE gen_bomreport_proc IS
DECLARE
    l_id number;
    l_document BLOB;

BEGIN
     l_document := APEX_UTIL.GET_PRINT_DOCUMENT (
          p_application_id          => 109,
          p_report_query_name          => 'qry_Report_1week',
          p_report_layout_name     => 'qry_Report_1week',
          p_report_layout_type     => 'application/excel',
          p_document_format          => 'xls'
     );

     l_id := APEX_MAIL.SEND (
          p_to        => 'to@me',
          p_from      => 'from@you',
          p_subj      => 'Weekly Report',
          p_body      => 'Please review the attachment.',
          p_body_html => 'Please review the attachment'
     );
 
   APEX_MAIL.ADD_ATTACHMENT (
       p_mail_id    => l_id,
       p_attachment => l_document,
       p_filename   => 'report_' || to_char(sysdate-8, 'YYYY') || '_' || to_char(sysdate-8, 'DD-MM') || '-' || to_char(sysdate-1, 'DD-MM') || '.csv',
       p_mime_type  => 'application/excel');
END;
And the query that is supposed to have run to generate the report saved as "qry_Report_1week".
SELECT organization_name, quote_description, quote_name, quote_pwd, user_id, contact_last_name || ', ' || contact_first_name contact_name,
  email, create_date, qty, unit_price, ext_price, discount_percent, company_name, item_no, supplier_name, product_category, mfg_part_no,
  quote_id, customer_id, exalt_user_id
FROM bom_detail_cdw2
where create_date BETWEEN sysdate-8 and sysdate-1 order by create_date;
I tried to start labor
begin
DBMS_SCHEDULER.RUN_JOB (
   job_name => 'GEN_XLS_RPT_AND_EMAIL',
   use_current_session => false);
end;
I've been reading about Planner, APEX_UTIL. GET_PRINT_DOCUMENT and APEX_MAIL. ADD_ATTACHMENT, but I'm sure I missed something. Any help would be appreciated... Thank you

Hello

As far as I know, you need a VALIDATION in the procedure otherwise nothing goes in the APEX_MAIL_QUEUE table.

HTH,

Chris

Tags: Database

Similar Questions

  • Automatic generation of reports and Email to aggregator

    Hi all

    I configured the auto builder but it did not work before, eventually he started working after I restarted the vm meter use. Now, it sends the email with the attached report the selected day of the month to the aggregator and my email addresses. Up to this so good, but the report is a detailed report of billing with details too that I don't want to share with the aggregator. There is no option to choose automatic reports global billing report. Is it possible to do? Send the report of global billing using automatic generation of reports.

    Thank you

    SN

    Hello. More recent versions of measure of consumption allow you to choose which report (s) to send. You may be using 2.2?

    Dave Briccetti

  • ESX 3.5 HA and DRS - fully automated parameters

    I have a two-node cluster and using DRS DRS In settings under "Fully automated" is a sliding bar to the Threshol "Migration." The default setting is in the middle. I have three questions for this...

    1: in the middle position, how long DRS allows the rampant Server eat before doing a vMotion CPU?

    2: the middle and dragging a tick in 'Aggressive' closest right how long DRS allows rampant Server eat before doing a vMotion CPU?

    3: If you select all of the "Aggressive" way, how long DRS allows the rampant Server eat before doing a vMotion CPU?

    Thank you

    Is not so much how long yet will to DRS for vMotion - the determining factor on the issue to know if DRS vmotion is if the virtual machines do not receive their last resources - so if you do not have a 'run away' vm and on ESX server is able to provide the necessary resources, the virtual machine will stay where it is at-see page 67 of the http://www.vmware.com/pdf/vi3_35/esx_3/r35u2/vi3_35_25_u2_resource_mgmt.pdf

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

  • Smartphones blackBerry is RIM read these messages? Where should I post the bug reports and suggestions for BB8900?

    I wonder where I should post the bug reports and suggestions for BB8900? I think that we have already found several bugs enjoyable device it is, but I've never seen any work email address to send these discoveries. I have also some proposals to improve the BB8900 features, making it even more attractive with minimal effort. We can actually open a new thread here and I can start posting bugs that I knew, but I'm not sure that everyone from RIM never reads these postings. All good ideas? Or maybe there is some forum tht could be used for this purpose?

    If you have any suggestions and information on RIM BlackBerry platform then post it here:

    http://supportforums.BlackBerry.com/Rim/Board?Board.ID=PM_Dev_Board

  • How can I report someones email address abuse?

    I'm on my msn and email abuse, how can I report and how do I get the aggressor to e-mail e-mail address

    Contact MSN Support:
    http://support.Microsoft.com/kb/940784

  • How to report an email with windows mail (windows 8 pro)

    I received an email on a flight I booked. I would like to report it so that I can easily find it in the future (IE closer when I fly). I use the 8 default windows messaging application provided with the operating system. I tried to click with the right button on the email so that research in all areas of the screen I have may think, but cannot find a way to report an email. What are my options for tracking? (it's got to be a better way 'mark as unread' or create a folder and dragging)

    In addition, despite the notifications being lit, the mail app does me not a pop-up notification at the top right of my screen when I get a new email. I also find my phone (via wifi and a network of cells) and the hotmail.com site will notify me on a new email well before the windows mail app 8 don't. How can I get rid of this delay?

    Wow... I don't know if all the world of MS - bed or will even care.

    But, I worked with my new Surface for 2 weeks now - and just thought that the function of the flag was hidden somehow.

    What a function of base have disappeared... I mean overall, the e-mail client is dismal at best - but yet the flag...

    Frankly, I'm about to send this thing back anyway - but this product was a real promise... but once Outlook was missing - and this email client has been had - how disappointing to say the least.

  • CSV to send reports and fixing dates

    I am trying to create a script that will send different reports. From now on I'm only instant reports and SCSI hardware, but I intend to add to my script once I learned how to get the current things to work properly. I wish I could create a spreadsheet for some of the data I receive and fix the spreadsheet to my email that I create. This is the code I have right now:

    $scsiLog = "C:\Users\myself\Documents\ScsiLogTest.csv".
    $rows = @)
    Get - VM | Get-SCSI controller. {ForEach-Object
    $row = $_
    $os = (get-VMGuest - vm $row.parent). OSFullName
    $row | Add-Member-type NoteProperty - name-value $os OS
    $rows = $rows + $row
    }
    $scsiReport = $rows | Select the Type, Parent, OS | Export-CSV $scsiLog

    $snapshotReport = get-file-vm name. Get - VM | Get-Snapshot | Select Name, VM, @{n = "Size"; e = {'{0:N2}' f $_.}} SizeMb}}, created. Out-string
    Send-mailmessage-to 'E-mail'-'email' - 'server'-'$snapshotReport, $scsiReport' body - SmtpServer topic 'Test report '.

    When I run that I am able to get the instant passage of my report to work properly, however I am not able to get the SCSI report to create a worksheet and attach it to the email. I know the portion of my code SCSI works fine if run by itself and does not seek to generate a mail so the problem is probably where I'm trying to use export-CSV $log.

    If you want to have this file as an attachment, use the attachment setting.

    Something like that

    Send-MailMessage -Attachments $scsilog -From "email" -To "email" -SmtpServer "server" -Body $snapshotReport -Subject "Report Test"
    
  • automatic scheduling of the report and send the output to the user by e-mail

    Hello
    Please I need scheduled report and send the output by email in discoverer. Please can someone help how to achieve this?

    Hello

    Yes, do you that.

    Please see Metalink Note 373812.1 how the schedule of reports to run at a given time while automatically the output electronics

    Thank you
    Fati

  • which computer is best for home use, including reports and spreadsheets?

    I've been using 'other' computer for many years at work and at home, had an iPhone several years ago and at the insistence of my daughter to Apple computer, I explore the possibility of buying an Apple computer. I need to type reports and do worksheets as a Secretary for an organization. I used Microsoft Office Word and Excel and need something similar, but without all the bugs and viruses. My laptop crashed a few days ago and I lost all the data and applications. Instead of the tedious task of restore all applications, this seems to be the time of the Apple store. Any suggestions? Mac, iPad, or do you use?

    caytn,

    I suggest to start by looking at your budget.  Knowing how much you can spend on a machine will considerably reduce the options.

    I expect that the options will be one of the following:

    MOBILE NO:

    Mac Mini: $500-$2200

    iMac: $1100 - $2400

    PORTABLE:

    MacBook: $1300-$1600

    MacBookPro: $1300-$2700

    I, personally, do NOT recommend an iPad for professional use

  • With the updated 31.4.0 version - demand for return confirmation and email send priority disappeared. How can I access them now? Thank you!

    With the updated 31.4.0 version - demand for return confirmation and email send priority disappeared.
    How can I access them now?

    Thank you!

    Did? I find in the title bar of the alternatives

  • I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. Help

    I have copy of old tbird and seamonkey e-mail files with the files and emails for each. I need to add to new tbird install. can not find a way to do it. HELP PLEASE. previous e-mail files are under mail then mail.earthlink* .net and each of the five mail .net is an email address I have. I can't find a way to identify each file by email to the specific email address (IE mail.my E-mail name.net) so I can copy the files and emails from the past to the email addresses now under tbird. previous installed e-mail identities may not be the current configuration of e-mail files in tbird. I think that I must be sure that mail.name.net matches the previous mail.name.net to be able to copy and paste the old to the new. is there a way to find the file name correct the old email and correspond to the new? all my emails very important information are mostly in the old mail electronic id and must be available in the identification of email again (but same) how can I do this?

    http://KB.mozillazine.org/Importing_folders

    Use this module.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

  • Unable to open a direct link with my SMS and email

    Hi, I have a 6 + 64 GB iPhone a year and 3 month old device.

    I noticed that since I downloaded and installed to 9.3 last IOS, I can't open a URL or a direct link on any of my text Messages and emails!  I click on the URL and nothing happens!  Help!  It's totally frustrating.  I shouldn't have installed the latest iOS.  Please tell me that there is an IOS update that corrects this frustration!

    Thank you.

    sumsplus wrote:

    Please tell me that there is an IOS update that corrects this frustration!

    You will have to show patience. Apple he has not yet released. In the meantime, see if something in this thread helps:

    Links, Hanging Apps: An overview of solutions

  • Safari and emails on my ipad freezes as soon as I click on any link.

    Safari and emails on my ipad freezes as soon as I click on any link. I am on ios 9.2.1.  When checking for updates, it is said that the software is uptodate. pls help. Thank you.

    Seeing that your iPad is updated probably has to do with 9.3 being pulled from servers. For the rest, it seems to be a bug or glitch with safari. Finally, I knew that he had no solution outside waiting for Apple to fix things. You can use another browser in the meantime and use it as a work-around. I use atomic but you can search for a browser in the app store that looks good to you and use it.

    Try to keep your finger pressed on the link until you see the popup 'copy' come then paste this link into the navigation bar of Safari and see if this allows you to follow the links.

  • form name and email are autofilled. Cannot remove

    I use the latest firefox 4/Vista... .see below

    When I go to some sites, the user name and the e-mail I used before a loooong time ago on another site automatically appear in the name field and email (in the comment section).

    I've never visited these sites before and still less posted something on them or used the e-mail/logon in a different way. There is no cookies associated with these sites in my cookies.

    I tried turnign off remember search and form history
    I tried to delete and move delete
    whenever I return to these areas of the site, same thing.
    I don't use any plugin autoform.

    I think that extra detective work may be necessary. Here's a thought. Some sites share comments, reviews and investigations. If you right-click close the form with the unwanted information in it, is there a 'this framework' in the context menu? If so, which follow to display the frame information see the area of the true source. You may need to clear cookies from this domain.

  • I don't remember my password or security questions, and email recovery is an old, that I no longer use. What can I do?

    I don't remember my password or security questions, and email recovery is an old, that I no longer use. What can I do?

    You will need to contact support in the country where you are (and therefore the country on your account) for questions (and the password) reset: Contact Apple for the Apple ID account security support

    If your country is not on this page, then try this form to contact Support: https://www.apple.com/emea/support/itunes/contact.html

    When they have been reset you can then update your email address of relief for possible future use: on your Apple ID - Apple Support email addresses

    Or if it is available in your country, you can substitute 2-step verification: frequently asked questions about two-step for Apple ID verification

Maybe you are looking for

  • Emails from TB

    TB emails don't show pictures if the pic is an attachment or in the body of the email. A 'frame' is here, but there is no pic.

  • can not display letters called captcha code using firefox

    When you access certain Web sites, we use a method to determine if a person or a computer accesses the site - its so-called captcha letters. Here are the letters of the alphabet distorted requiring an interpretation by a human being. I am unable to s

  • Detection of devices USB on Satellite A100-507

    Hello! I have a Toshiba Satellite A100-507 and since I installed a USB for my polar watch the laptop doesn't recognize most devices (printer, USB stick) usb, The only thing that works is my usb mouse! When I plug the printer or a USB Windows XP (pro,

  • How to export to the desktop computer

    Hey all,. If it is explicit I always missed it. How to export a file size reduced as 854 x 480 on the desktop? Choosing share to apple device gives me the opportunity to share, but where is this file? Thank you Al

  • Laptop doesn't say no boot device found no hard disk 3F0 operating system

    My laptop says peripheral boot not found please install system of operating on your hard drive. Hard drive (3F0) F2 diagnostics of the system for more information visit www.hp.com/go/techcenter/startup. My laptop was purchased in December and in Febr