Using apex_util.get_print_document with DBMS Scheduler

I'm trying to run report_query from DBMS_SCHEDULER job. When the job tries to execute I get this error in dba_scheduler_job_run_details. Notsure how to debug this. Any ideas?
Select error#, additional_info from dba_scheduler_job_run_details where job_name ='TEST10'
6502
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "APEX_030200.WWV_FLOW_RENDER_QUERY", line 644
ORA-01003: no statement parsed
ORA-06512: at "APEX_030200.WWV_FLOW_RENDER_QUERY", line 1469
ORA-06512: at "APEX_030200.WWV_FLOW_UTILITIES", line 9233
ORA-06512: at "APEX_030200.HTMLDB_UTIL", line 1836
ORA-06512: at "SIS_EXPRESS.SIS_EXPRESS_REPORTS", line 867
ORA-06512: at line 2
DECLARE l_report_blob blob;
l_id number;
l_application_id report_scheduler_job.application_id%TYPE;
l_application_owner report_scheduler_job.application_owner%TYPE;
l_report_query_name report_scheduler_job.report_query_name%TYPE;
l_report_layout_name report_scheduler_job.report_layout_name%TYPE;
l_output_format varchar2(10);
BEGIN
l_report_blob := apex_util.get_print_document(
p_application_id => l_application_id,
p_report_layout_name => l_report_layout_name,
p_report_query_name => l_report_query_name,
p_report_layout_type => l_output_format,
p_document_format => l_output_format,
p_print_server => null);
END:

You must use a "replace" function in you sql querie for the special characters. for example:
select replace(replace(customer_name,''&'',''%26amp;''),chr(39),''%26apos;'') customer_name
   from accounts

Similar Messages

  • Running apex_util.get_print_document with APEX_MAIL

    I am trying to automate the running of an apex_util.get_print_document, emailing the output to my users. When the job tries to run I get this error in the log:
    ORA-20022: Null value supplied for parameter p_attachment.
    ORA-06512: at "FLOWS_030100.WWV_FLOW_MAIL", line 731
    ORA-06512: at "SIS_EXPRESS.SIS_EXPRESS_REPORTS", line 154
    ORA-06512: at line 2
    Not sure where I can check this to see the problem. Anybody do this before?
    BEGIN
    l_report_blob := apex_util.get_print_document(
    p_application_id => l_application_id,
    p_report_layout_name => l_report_query_name,
    p_report_query_name => l_report_query_name,
    p_report_layout_type => l_output_format,
    p_document_format => l_output_format,
    p_print_server => null);
    l_id := APEX_MAIL.SEND( p_to => '[email protected]',
    p_from => '[email protected]',
    p_subj => 'APEX_MAIL with attachment',
    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_report_blob,
    p_filename => l_report_query_name,
    p_mime_type => l_mime_type);
    COMMIT;
    END;

    Hi Paul,
    APEX_UTIL API consists of 4 different GET_PRINT_DOCUMENT Functions based on parameters types(Function Overloading) that are being passed. If you look at the function where CLOB is the data type for parameter p_report_data, the bind variables can be passed to the SQL which willl be used by DBMS_XMLGEN or other XML/CLOB generation API's.
    I have used DBMS_XMLGEN to generate the CLOB data which intern used by GET_PRINT_DOCUMENT function.
    Regards
    Shesh

  • Help with DBMS Schedule

    Hello,
    i have crated a dbms job usning dbms scheduler. i created a procedure to test this which has run every 28 days on a Wednesday. when i test this this job skips if a holiday falls on wEDNESDAY AND SHOULD RUN ON IMMEDAITE NEXT WEEK OF WEDNESDAY. my job works upto excluding the holidays, but doesn;t run immediate next wednesday instead its running the next shceduled 28 day of that wednesday. here is the code to test the job. PLease help...
    BEGIN
    SHOW_JOB_SCHEDULE(
    sTARTDate => TO_DATE('01/04/2012','mm/dd/yyyy')
    ,ScheduleString => 'FREQ=DAILY; INTERVAL=28; BYHOUR=04; BYMINUTE=00; BYSECOND=00;EXCLUDE=FEDERALHOLIDAYS;'
    ,Iterations => 10
    end;
    i tried even with freq=weekly and interval=4 and byday=wed it still skips the Job if that is a holiday and goes to the next shceduled cycle instead i want to run next wednesday, when a holiday falls.
    say for example the dates of cylce for 28 days is:
    1/4/2012
    1/31/2012
    02/28/2012
    03/27/2012
    04/24/2012 etc....
    could someone help pelase.....
    Thanks a lot....

    Maybe you could do something like this:
    CREATE OR REPLACE PROCEDURE create_holiday_schedules
    ( p_year IN NUMBER )
    AS
         lv_hol_schedule    VARCHAR2(200);
         lv_offhol_schedule VARCHAR2(200);
         sched_not_exists   EXCEPTION;
         PRAGMA EXCEPTION_INIT(sched_not_exists, -27476);
    BEGIN
         /* Drop pre-existing Schedules */
         BEGIN
              DBMS_SCHEDULER.DROP_SCHEDULE
              ( schedule_name => 'FEDERAL_HOLIDAYS'
              , force         => TRUE
              DBMS_SCHEDULER.DROP_SCHEDULE
              ( schedule_name => 'OFF_FEDERAL_HOLIDAYS'
              , force         => TRUE
         EXCEPTION
              WHEN sched_not_exists THEN
                   NULL;
         END;
         /* Retrieve holidays and off days */
         WITH dts AS
              SELECT TO_DATE('01/01/' || p_year,'MM/DD/YYYY')                AS pStartDate
                   , ADD_MONTHS(TO_DATE('01/01/' || p_year,'MM/DD/YYYY'),12) AS pEndDate
              FROM   dual
         SELECT LISTAGG(TO_CHAR(dt_day,'DDD'),',') WITHIN GROUP (ORDER BY dt_day) AS hol_days
              , LISTAGG(TO_CHAR(dt_day + 7,'DDD'),',') WITHIN GROUP (ORDER BY dt_day) AS offhol_days
         INTO   lv_hol_schedule
              , lv_offhol_schedule
         FROM
              SELECT (CASE WHEN
              /* New Year's Day (01/01) */
              (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(TRUNC((pStartDate+(level-1)),'year'),'DY') = 'SAT'                                                        /* If New Year's falls on SAT, observe on Friday */
                                                      THEN TRUNC((pStartDate+(level-1)),'YEAR')- INTERVAL '1' DAY                                    
                                                      WHEN TO_CHAR(TRUNC((pStartDate+(level-1)),'year'),'DY') = 'SUN'                               /* If New Year's falls on SUN, observe on Monday */
                                                      THEN TRUNC((pStartDate+(level-1)),'YEAR')+ INTERVAL '1' DAY
                                                      ELSE TRUNC((pStartDate+(level-1)),'year')
                                                 END)
              /* Martin Luther King Day (Third Monday in January) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(TRUNC((pStartDate+(level-1)),'YEAR'),'DY') = 'MON'
                                                      THEN TRUNC((pStartDate+(level-1)),'YEAR')+ INTERVAL '14' DAY
                                                      ELSE NEXT_DAY(TRUNC((pStartDate+(level-1)),'YEAR'),'MONDAY')+ INTERVAL '14' DAY
                                                 END)
              /* Washington's Birthday (Third Monday in February) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),1),'DY') = 'MON'
                                                      THEN ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),1)+INTERVAL '14' DAY
                                                      ELSE NEXT_DAY(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),1),'MONDAY')+ INTERVAL '14' DAY
                                                 END)
              /* Memorial Day (Last Monday in May) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),5)- INTERVAL '7' DAY,'DY') = 'MON'
                                                      THEN ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),5)- INTERVAL '7' DAY
                                                      ELSE NEXT_DAY(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),5)- INTERVAL '7' DAY,'MONDAY')
                                                 END)
              /* Independence Day (Always 07/04) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(TRUNC(TO_DATE('07/04/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SAT'                          /* If Independence Day falls on SAT, observe on Friday */
                                                      THEN TO_DATE('07/04/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')- INTERVAL '1' DAY
                                                      WHEN TO_CHAR(TRUNC(TO_DATE('07/04/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SUN'      /* If Independence Day falls on SUN, observe on Monday */
                                                      THEN TO_DATE('07/04/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')+ INTERVAL '1' DAY
                                                      ELSE TO_DATE('07/04/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')
                                                 END)
              /* Labor Day (First Monday in September) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),8),'DY') = 'MON'
                                                      THEN ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),8)
                                                      ELSE NEXT_DAY(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),8),'MONDAY')
                                                 END)
              /* Columbus Day (Second Monday in October) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),9),'DY') = 'MON'
                                                      THEN ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),9)+INTERVAL '7' DAY
                                                      ELSE NEXT_DAY(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),9),'MONDAY')+ INTERVAL '7' DAY
                                                 END)
              /* Veteran's Day (Always 11/11) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(TRUNC(TO_DATE('11/11/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SAT'                          /* If Veteran's Day falls on SAT, observe on Friday */
                                                      THEN TO_DATE('11/11/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')- INTERVAL '1' DAY
                                                      WHEN TO_CHAR(TRUNC(TO_DATE('11/11/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SUN'      /* If Veteran's Day falls on SUN, observe on Monday */
                                                      THEN TO_DATE('11/11/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')+ INTERVAL '1' DAY
                                                      ELSE TO_DATE('11/11/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')
                                                 END)
              /* Thanksgiving (Fourth Thursday in November) */
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),10),'DY') = 'THU'
                                                      THEN ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),10)+INTERVAL '21' DAY
                                                      ELSE NEXT_DAY(ADD_MONTHS(TRUNC((pStartDate+(level-1)),'YEAR'),10),'THURSDAY')+ INTERVAL '21' DAY
                                                 END)
              /* Christmas (Always 12/25) */          
              OR (pStartDate+(level-1)) = (CASE WHEN TO_CHAR(TRUNC(TO_DATE('12/25/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SAT'                          /* If Christmas Day falls on SAT, observe on Friday */
                                                      THEN TO_DATE('12/25/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')- INTERVAL '1' DAY
                                                      WHEN TO_CHAR(TRUNC(TO_DATE('12/25/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')),'DY') = 'SUN'      /* If Christmas Day falls on SUN, observe on Monday */
                                                      THEN TO_DATE('12/25/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')+ INTERVAL '1' DAY
                                                      ELSE TO_DATE('12/25/' || TO_CHAR(pStartDate+(level-1),'YYYY'),'MM/DD/YYYY')
                                                 END)
              THEN 'HOL'
              ELSE TO_CHAR(pStartDate+(level-1),'DY')
              END) days
              , pStartDate+(level - 1) AS dt_day
              FROM dts
              CONNECT BY level <= pEndDate-pStartDate
         WHERE days IN ('HOL')
         DBMS_SCHEDULER.CREATE_SCHEDULE
         ( schedule_name   => 'FEDERAL_HOLIDAYS'
         , start_date      => TO_DATE('01/01/' || p_year,'MM/DD/YYYY')
         , repeat_interval => 'BYYEAR_DAY=' || lv_hol_schedule
         , end_date        => ADD_MONTHS(TO_DATE('01/01/' || p_year,'MM/DD/YYYY'), 12)
         , comments        => 'Federal Holidays'
         DBMS_SCHEDULER.CREATE_SCHEDULE
         ( schedule_name   => 'OFF_FEDERAL_HOLIDAYS'
         , start_date      => TO_DATE('01/01/' || p_year,'MM/DD/YYYY')
         , repeat_interval => 'BYYEAR_DAY=' || lv_offhol_schedule
         , end_date        => ADD_MONTHS(TO_DATE('01/01/' || p_year,'MM/DD/YYYY'), 12)
         , comments        => 'Federal Holidays'
         /* Still need to enable jobs that use these schedules as they are disabled automatically */
         DBMS_SCHEDULER.ENABLE( name => 'My Job');
    END;
    /This is an adaptation of a query I wrote to automatically figure out working days for a giving start and end date range. I tweaked it to return the days of which a US Federal Holiday falls and when it's observed. For example if Christmas fell on a Sunday it'd be observed on a Monday. So once we have the list of holidays we can add a week to them to get the days that are required for the run on the following week. After that I use the 11g LISTAGG function to aggregate that data into a single string that will be used to create the schedule per the calendar syntax requirements. Then the schedules are created.
    Please note that I drop the schedules at the start of the procedure which disables any jobs that use them. You'll need to enable those jobs again after the fact.
    Additionally, you can take the query I have hear and replace it to me your needs. I just provided it as an example. This procedure has been parameterized so it can be run again every year re-creating the schedules.
    Edited by: Centinul on Jan 31, 2012 10:54 AM

  • Apex_util.get_print_document with bind

    All,
    I'm trying to create a process to bulk print a report to the file system using the API apex_util.get_print_document. Is there a way to pass bind variables to the report query when using this API? If not, has anyone come up w/another solution on mass printing reports that have parms?
    Thanks,
    Paul

    Hi Paul,
    APEX_UTIL API consists of 4 different GET_PRINT_DOCUMENT Functions based on parameters types(Function Overloading) that are being passed. If you look at the function where CLOB is the data type for parameter p_report_data, the bind variables can be passed to the SQL which willl be used by DBMS_XMLGEN or other XML/CLOB generation API's.
    I have used DBMS_XMLGEN to generate the CLOB data which intern used by GET_PRINT_DOCUMENT function.
    Regards
    Shesh

  • Call print apex_util.get_print_document() with page item values

    Hi all
    I ran into an issue that very frustrated as it sounds so simple.
    I'm in Apex 3.1.
    My database has table TAB_CLASSES, TAB_STUDENT
    My application has page 1 with P1_SID is student_ID
    I had an simple report query name Class_query, show all classes that a student attends
    select * from TAB_CLASSES where SID = :P1_SID;
    I also select option "include application and session information"
    I had report template Class_template
    In my application, I have a process tried to generate report list classes for all students.
    l_report blob;
    for x in (select * from TAB_STUDENT)
    loop
    :P1_SID := x.SID;
    l_report := apex_util.get_print_document (
    p_application_id => :APP_ID,
    p_report_query_name => 'Class_query',
    p_report_layout_name => 'Class_template',
    p_report_layout_type => 'rtf',
    p_document_format => 'pdf'
    insert all the l_report into database with SID as a part of l_report name (*) 
    end loop;
    After this, I got multiple of l_report blob in database, number of report is exactly number of student in the TAB_STUDENT table. The problem is that every report looks the same, and it got the information of only first student
    I guessed it did not pass the item value (P1_SID) every time it call the get_print_document, but it still shows in the report name (*)
    Please help me. Thanks for any idea.
    Teiv
    Edited by: teiviag on Mar 10, 2010 7:16 AM

    This post had the same problem with me
    [ http://forums.oracle.com/forums/thread.jspa?threadID=663186&start=0&tstart=0|http://forums.oracle.com/forums/thread.jspa?threadID=663186&start=0&tstart=0]
    Thanks for the post of Marc, about how variables are binding and calling by process, I changed my app design to have a sp to print and store the pdf file. Then in my app, I just called the sp and passed the P1_SID. It worked.
    Thanks.
    Edited by: teiviag on Mar 10, 2010 10:49 AM
    Edited by: teiviag on Mar 10, 2010 10:50 AM
    Edited by: teiviag on Mar 10, 2010 10:50 AM

  • Help using /AFS/BAPI_PO_CREATE with multiple schedule lines

    I'm using /AFS/BAPI_PO_CREATE to create POs and everything works fine until I pass an item with multiple schedule lines. 
    When you pass multiple schedules it is giving each of the schedule lines under an item the same grid value!  So if I want to order one black, one white shirt...  both grid values are changed to black when the PO is created.
    I'm wondering if you need to pass some sort of sequence value into the BAPI when you have multiple schedule lines for an item.  Does anyone know?

    Hi Justin
    Please make sure that you are specifying the <b>item number</b> while passing the ITEM Details and their correponding SCHEDULE lines.
    Though i couldnt find FM: /AFS/BAPI_PO_CREATE in our system, i guess it is similar to BAPI_PO_CREATE.
    Kind Regards
    Eswar

  • Apex_util.get_print_Document not working outside apex environment

    I am working on one of the assignment in Apex 4.0.2 .
    The requirement is to dynamically generate reports and mail to User using the Scheduler program(Pl/sql) -> dbms_scheduler.
    I have used BI publisher to create the template and xml data for the report(Excel) and used Apex_util.get_print_Document
    in the scheduler program (which is written outside Apex), but this is not working properly,sends blank report to email.
    Please suggest how to set the apex session and use Apex_util.get_print_Document to work properly outside apex env.

    Apex (PL/SQL web-enabled) code needs to execute inside an Oracle server session that has been properly and correctly initialised for executing web enabled PL/SQL code.
    An example of how to execute such PL/SQL by intialising a proper environment, is shown in {message:id=2251131}.
    Note that this will not be able to execute Apex pages (via the flow engine) that are not public - that needs a proper authenticated Apex web session. Which could be a tad complex to emulate in this fashion.

  • Apex_util.get_print_document results in "503-service unavailable"

    I'm using APEX 4.2.0.3.00.08 with GlassFish 3.1.2.2 on an Oracle 10.2.0.5 database.
    Recently I created a report-query together with a xsl-fo report-layout created in Altova Stylevision. I've enabled and configured print-options and when I press my application button, I'm perfectly capable of viewing and/or saving the pdf-version of my report.
    Additionally I want to save my report as BLOB in the database, but when I try this using apex_util.get_print_document, all I get in my table is a html-page containing the message "503-service unavailable".
    I used the following page as reference:
    Creating High Fidelity PDF Reports with Oracle Application Express but apparently I'm missing something or doing something wrong......I truly hope there's someone out here to help me!!
    Thanks in advance!

    Hello Mike,
    I've been trying to create an application on apex.oracle.com to reproduce the problem, but I can't seem to get it to work.
    I've uploaded a very simple layout created in StylusStudio, a simple query on the EMP-table only containgin FIRST_NAME, LAST_NAME and EMAIL and when I add the layout to the query and press "Test report", it works fine.
    When I run the report from my application, it only shows a pdf with a thick, horizontal lines, like it's showing only empty cell borders.
    Meanwhile I found out that the APEX-listener keeps reporting similair errors, even when I use that same simple stylesheet (created with StylusStudio) on the EMP-table, even when the stylesheet does not contain any special characters at all. In stead of the message starting with INFO: Character decoding failed. Parameter [#x200B;</xsl:text> , it then ignores the complete xslt-stylesheet (the complete contents of the stylesheet is between the brackets, in stead of just the string containg the special chars).
    To be honest I'm a little lost now. First my focus was on how to get rid of the special characters, but now it looks like, even when I might succeed in that, it doesn't even solve my problem.
    Any idea why my application doesn't show me the same report I see when testing the report-query?
    The application can be found here:
    https://apex.oracle.com/pls/apex/htmldb/f?p=29586
    The bottom region is an attempt to show the pdf with the highest id, but I think it does not show the actual pdf (http-404)
    The source for that PL/SQL region is:
    declare
      src_  varchar2(256);
      mime_ varchar(48);
      id_   number;
    begin
    select max(id)
    into id_
    from report_archive;
        select mimetype
          into mime_
          from report_archive
         where id = id_;
        src_ := 'src="#OWNER#.download_doc?i_doc_id=' || id_ || '" ';
        htp.p('<div style="">');
        if instr(mime_,'pdf') > 0 then
          htp.p('<embed height="800" width="1200" name="statement" ');
        elsif instr(mime_,'excel') > 0 then
          htp.p('<embed height="800" width="1200" name="statement" ');
        else
          htp.p('<embed height="800" name="statement" ');
        end if;
        htp.p(src_);
        htp.p('type="' || mime_ || '" />');
        htp.p('</div>');
    exception
       when no_data_found then
          null;
    end;
    I really hope we can solve this!!!!
    Best regards,
    Marco

  • Making apex_util.get_print_document return an error message

    We are using apex_util.get_print_document in a process to run a report something like this:
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    end;And this works well most of the time. The problem is, if the report fails for some reason, apex_util.get_print_document gives no information whatsoever as to what went wrong. Is there any way at all we can find out what the problem was?
    Application Express 4.0.2.00.07
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Hi,
    add exception to your code.
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    EXCEPTION
       WHEN OTHERS THEN
          raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;This will give proper error message.
    Hope this will helps you.
    Regards,
    Jitendra

  • Apex_util.download_print_document with clob file

    Has anybody had success using apex_util.download_print_document with a clob data file (instead of Report Query)? I'm trying this with an XML dataset and rtf. document that works if I try in Word BI -Plugin. If I try code below from APEX page I get an error saying there is something wrong with the document.
    apex_util.download_print_document(
    p_file_name => 'test',
    p_content_disposition => 'attachment',
    p_report_data => test_clob('',''),
    p_report_layout => 'ID_LST',
    p_report_layout_type => 'rtf',
    p_document_format => 'pdf',
    p_print_server => null);
    CREATE OR REPLACE FUNCTION test_clob (p_username in varchar2,
    p_password in varchar2) return CLOB IS
    v_clob CLOB;
    BEGIN
    v_clob := dbms_xslprocessor.read2clob('INTERFACES','id_lst.xml');
    return(v_clob);
    END test_clob;

    FOP : [http://www.oracle.com/technology/products/database/application_express/html/configure_printing.html]
    Cocoon: [http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html]
    Jasperreports: [http://blog.dunull.org/?page_id=70]
    Thank you,
    Tony Miller
    Webster, TX

  • Apex_util.download_print_document with Oracle XE?

    Hi!
    Can anyone tell me whether it is possible to use apex_util.download_print_document with Oracle XE?
    And can I do so without BI Publisher?
    If not, please point me to some solution that allows me to print PDF from my apps.
    Thanks!
    Remco

    FOP : [http://www.oracle.com/technology/products/database/application_express/html/configure_printing.html]
    Cocoon: [http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html]
    Jasperreports: [http://blog.dunull.org/?page_id=70]
    Thank you,
    Tony Miller
    Webster, TX

  • Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please.

    Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please before I throw it through the window!

    Grum12 wrote:
    Hi I'm a total novice, as you will see. But Iam trying to use template of an employee schedule but when I try to add extra columns it does not add the preset formula with it, so it works out total hours and total pay?   If any one can help please before I throw it through the window!
    Hi Grum,
    If the formulas aren't filling to the new column, you must have changed something in the template since you first opened it. Numbers is rather fussy about filling row content in columns as they are added. Only rows with the same expression in every Body Column will fill when a column is added. Just as an experiment, start a new Employee Schedule document from the Template Chooser and then add a column by clicking the Add Column handle in the upper right corner of the table. If that works, as it should, then think about what might have changed in your working document to disconnect that feature. Maybe we can figure it out together.
    Jerry

  • How can I  get System dates  with time scheduler using threads

    how can I get System dates with time scheduler using threads.is there any idea to update Date in my application along with system Date automatic updation...

    What the heck are you talking about and whatr has it to do with threads?
    Current time: System.currentTimeMillis. Date instances are not supposed to be updated.

  • DBMS scheduler jobs running twice

    Hi,
    I have 4 DBMS scheduler jobs , which checks for a specific job status in DB and sends an email , when i started the schedule for the first week the jobs executed fine from next week I am getting two emails from each job , when i check the logs USER_SCHEDULER_JOB_RUN_DETAILS I see only one run , which seems weird to me so i disabled one job and left the three jobs in schedule , next time i got two emails from 3 jobs and one from disabled job . After checking logs i see that there is no entry of the disabled job execution . I am not sure where is the problem i can't find any log from where the disabled job executing. Please help me
    Job schedule is to run every Saturday
    Interval setup :
    start_date => trunc(SYSDATE)+ 8.5/24,
    repeat_interval => 'TRUNC(LEAST(NEXT_DAY(SYSDATE,''SATURDAY'') )) + 8.5/24'
    Suresh

    Hi,
    I tried to schedule the same jobs using DBMS_JOB but i still get the same problem , I created the procedure with all code in and scheduled it using dbms job , first day it run once second day it run twice ( sending two emails) Inow i am not sure if issue is with my code or scheduler
    Procedure
    Declare
    v_count number;
    v_Recipient VARCHAR2(400) := '[email protected]';
    v_Subject VARCHAR2(80) := 'TEST_Email';
    v_Mail_Host VARCHAR2(30) := 'localhost';
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    BEGIN
    select count(*) into v_count from TEC_CODERETURN@RPRD where interface like 'FOR002B' and trunc(rundate) =trunc(sysdate);
    if v_count = 0
    then
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Rcpt(v_Mail_Conn, '[email protected]');
    UTL_SMTP.OPEN_DATA(v_Mail_Conn);
    utl_smtp.WRITE_RAW_DATA(v_Mail_Conn, UTL_RAW.CAST_TO_RAW(
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || UTL_TCP.CRLF ||
    'From: ' || '[email protected]' || UTL_TCP.CRLF ||
    'Subject: '|| v_Subject || UTL_TCP.CRLF ||
    'To: ' || v_Recipient || UTL_TCP.CRLF ||
    'This is a test Alert'|| UTL_TCP.CRLF
    UTL_SMTP.CLOSE_DATA(v_mail_conn);
    utl_smtp.Quit(v_mail_conn);
    end if;
    EXCEPTION
    WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
    raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    DBMS job creation
    DECLARE
    jobno NUMBER;
    BEGIN
    DBMS_JOB.submit
    (job => jobno,
    what => 'TEST_ALERT;',
    next_date => trunc(sysdate)+0.1/24,
    interval => 'SYSDATE + 1',
    no_parse => TRUE );
    DBMS_OUTPUT.put_line ('Created Job - the job number is:' || TO_CHAR (jobno));
    COMMIT;
    END;
    Suresh

  • APEX_UTIL.GET_PRINT_DOCUMENT Error Unable to get the document

    Hi,
       I am working on Oracle APEX 4.1 to send the report as an attachment through mail  I am unable to get the document while calling the APEX_UTIL.get_print_document. I have created a report query and report template (rtf template) so as to send the report as an email attachment. The report works fine individually upon clicking of button so there is no issue in BI publisher configuration. I am sure there is something very trivial which I am missing out here. Any help will be appreciated.
    Declare
       l_id number;
       l_document BLOB;
       l_error_msg varchar2(2000);
    BEGIN
       l_document := APEX_UTIL.GET_PRINT_DOCUMENT
             p_application_id=>'123',
             p_report_query_name=>'Sample_Report',   
             p_report_layout_name=> 'Sample_Report',
             p_report_layout_type=>'RTF',
             p_document_format=>'PDF',
             p_print_server => 'f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=Sample_Report'
       IF l_document is null
       THEN
           dbms_output.put_line( ' no report returned');
          l_error_msg:='<html> <body> <h1 > Apologies the report was not returned from the apex , as there is some printing issues </h1> </body> </html> ';
       ELSE
          l_error_msg:=null;
       END IF;
       IF l_error_msg IS NULL THEN
           l_id := APEX_MAIL.SEND(
           p_to => '[email protected]',
           p_from => '[email protected]',
           p_subj => 'APEX_MAIL with attachment',
           p_body => 'Please review the attachment.',
           p_body_html => '<b>Please</b> review the attachment' || l_error_msg);
          dbms_output.put_line(l_id);
          IF l_document is not null then
             APEX_MAIL.ADD_ATTACHMENT (
                        p_mail_id => l_id,
                        p_attachment => l_document,
                        p_filename => 'Sample_Report.pdf',
                        p_mime_type => 'application/pdf');
          END IF;
    END IF;
    END;
    Here the output says no report returned.
    Thanks & Regards
    Ahmed

    Try removing the parameter p_print_server from the call.  This will use your default print server which should already be configured to use the BI Publisher engine.

Maybe you are looking for

  • Can no longer change the G/L account in AO90

    Hi! I have a problem changing the G/L account in AO90 for an account determination where I have posted the wrong account. Since I have already created assets with an account determination that includes this account, it says that I "can no longer chan

  • Minimisation and controlling button clicks in swings

    Hello All, I had some problem in swings. Here I am giving my problem in detail. 1st ...... On one window named as "Main Screen" contains two buttons. Say Button1 and Button2. By clicking on Button1 another window will be opened named as "Sub Screen1"

  • Smtp sender restrictions question

    I have the following in my main.cf file for sender restrictions. permitsasl_authenticated,permit_mynetworks,rejectn onfqdnsender,permit Seems pretty standard, but I have had some students in my district send emails to teachers as [email protected] No

  • ERROR:Configuration:continueToMetaViewFromResource

    Hi, I installed brand new IDM6 with sp2 and created new RACF resource. when I change the List User AtrParse I got this error. Deos anyone know what it means? I can not find any log for this error? ERROR:Configuration:continueToMetaViewFromResource

  • Menu bar not visible

    My Final Cut menu bar only appears when I move cursor to top of screen. Then it disappears when I move cursor away from top of screen. I am NOT in full screen mode. This issue began happening after I deleted preferences. Is there a way to have menu b