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
Similar Messages
-
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 AMThis 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 -
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 -
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 -
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
AhmedTry 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.
-
APEX_UTIL.GET_PRINT_DOCUMENT always returning empty BLOB
Dear community,
I have a huge problem when using the function APEX_UTIL.GET_PRINT_DOCUMENT in a job or database procedure.
The following code runs perfectly when I integrate it in the APEX application directly e.g. using a button to execute it (of course I use an anonymous PL/SQL block in APEX itself). But when I run the same code as a procedure or job in the APEX database itself I always receive a mail with an empty PDF:
CREATE OR REPLACE PROCEDURE APEX_DRUG_SAFETY.CALL_MAIL
is
l_id number;
l_document BLOB;
BEGIN
wwv_flow_api.set_security_group_id;
l_document := APEX_UTIL.GET_PRINT_DOCUMENT
+(+
p_application_id=>'105',
p_report_query_name=>'TestReport',
p_report_layout_type=>'pdf',
p_document_format=>'pdf'
+);+
l_id := APEX_MAIL.SEND
+(+
p_to => '[email protected]',
p_from => '[email protected]',
p_subj => 'sending PDF via print API',
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 => 'mydocument.pdf',
p_mime_type => 'application/pdf'
+);+
wwv_flow_mail.push_queue(
P_SMTP_HOSTNAME => 'DESMTP.TEST.COM',
P_SMTP_PORTNO => '25');
end;
The problem is that the function APEX_UTIL.GET_PRINT_DOCUMENT always returns an empty BLOB when executed outside of the APEX application. I found this issue in several other posts in this forum but I did not find a solution.
The mail transmission itself works perfectly. Also with an attachment if e.g. I use another BLOB already stored in the database for testing purposes. So it is not the mail transmission that causes the problem but the empty variable l_document that is still empty.
Thanks in advance for the help.user9007075 wrote:
Dear community,
wwv_flow_api.set_security_group_id;
you should be using this
l_workspace_id := apex_util.find_security_group_id (p_workspace => 'YOUR_WORKSPACE_NAME');
apex_util.set_security_group_id (p_security_group_id => l_workspace_id);
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#AEAPI512 -
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 -
Apex_util.get_print_document returns empty blob
Hi,
I'm trying to convert a xsl-fo template into PDF. I have the following code:
begin
declare
v_retval blob;
v_data blob;
v_xls clob;
v_xml_dat clob;
begin
select page_template
into v_xls
from flows_030100.wwv_flow_report_layouts
where flow_id =101
and report_layout_name = 'vv';
v_xml_dat := to_clob('<data><row><dat1>fff</dat1></row></data>');
v_data := wwv_flow_utilities.clob_to_blob(v_xml_dat);
v_retval := apex_util.get_print_document (v_data,v_xls,'xsl-fo','pdf')
htp.p(dbms_lob.getlength(v_retval));
end;
end;
This returns 0 instead of some PDF document. I guess there is something wrong with my input, probably the XML data. Any thoughts?Anyone?
-
APEX_UTIL.GET_PRINT_DOCUMENT not returning anything
I have a report query and have provided a layout to print it
I need to get the html generated from the report so that I can mail it.
As I could not get the generated file in the PL/SQL package written , for quick testing I started testing using a SQL stmt to check for the length of the LOB
select dbms_lob.getlength(APEX_UTIL.GET_PRINT_DOCUMENT (
p_application_id=>my_app_id,
p_report_query_name=>'name of qry',
p_report_layout_name=>'name of layout',
p_report_layout_type=>'rtf',
p_document_format=>'htm')) lob_size
from dual
I also tried by providing the p_print_server => null in addition to the parameters passed.
But the query returns NULL only.
The qry and layout are correct as the query when tested in the edit qry screen in APEX shows the output report in the format required (including html , PDF etc)
Any pointers ?
Thx
Edited by: user618186 on Apr 24, 2009 2:35 PM
Edited by: user618186 on Apr 24, 2009 2:36 PMI have the same problem exactly...works as an APEX proc, will not work from sqlplus despite setting security group id. Mail works. Attachments with another BLOB works. But I can't get this function to give me the BLOB.
-
Apex_util.get_print_document not generating correct output
hello,
Basically what I've done is this.
1) stored a very simple xml file in a clob field called xml_file_clob in a table called xml_test1
2) stored an rtf file in a clob field called rtf_layout in a table called xml_test1
3) created a procedure (below) called generate_report_as_blob which attempts to combine the xml and layout and generate a PDF from it which is stored into a blob field in the same table where 1) and 2) are above .....
4) I have confirmed that taking the clobs in 1) and 2) from the table above and creating xml and rtf files on my desktop that I can open the rtf file in Word, load the xml file and preview it and it does render the pdf as intended (so I think my clobs in the table are good)
5) run the procedure below. It compiles and runs with no errors but generates a file into the blob column that when downloaded to my desktop looks like the below output (when opening w/ pdf it says there was an error opening the file)
Any thoughts are greatly appreciated. I feel like I'm really close and am excited about what I could do with this if this can work.
Thanks in advance, KW
=========================================================================
MY PROC
============================
procedure generate_report_as_blob is
v_xml xmltype;
rtf_layout clob;
v_rpt_output blob;
v_xml_rpt_data clob;
begin
select xml_file_clob, rtf_layout_clob
into v_xml_rpt_data, rtf_layout
from xml_test1
where xml_id = 2;
v_rpt_output :=
apex_util.get_print_document(p_report_data => v_xml_rpt_data
,p_report_layout => rtf_layout
,p_report_layout_type => 'rtf'
,p_document_format => 'pdf'
,p_print_server => null);
update xml_test1
set rpt_pdf_output = v_rpt_output
where xml_id = 2;
commit;
end generate_report_as_blob;
==========================================================================
==========================================================================
MY OUTPUT (as apdf file) :
=================
%PDF-1.4
1 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
2 0 obj
<<
/Type /Info
/Producer (Oracle BI Publisher 10.1.3.4.0)
>>
endobj
3 0 obj
<<
/Type /Pages
/Kids [
/Count 0
>>
endobj
4 0 obj
<<
/ProcSet [ /PDF /Text ]
>>
endobj
xref
0 5
0000000000 65535 f
0000000010 00000 n
0000000065 00000 n
0000000147 00000 n
0000000208 00000 n
trailer
<<
/Size 5
/Root 1 0 R
/Info 2 0 R
/ID [<fdd8d0c54769561cc797a7c9d0ae42cd><fdd8d0c54769561cc797a7c9d0ae42cd>]
>>
startxref
258
%%EOF
====================================
Edited by: Ken Wood on Oct 30, 2009 8:56 AMI have the same problem exactly...works as an APEX proc, will not work from sqlplus despite setting security group id. Mail works. Attachments with another BLOB works. But I can't get this function to give me the BLOB.
-
Apex_util.get_print_document
All,
below is a procedure (test_send_attachment1) that I cannot get to work and I've run out of ideas.
The value of xml_file_clob is detailed below and the rtf file spec is also provided. With these things, someone could, I believe, reproduce the problem.
I don't receive any errors and I do receive an email with a pdf attached. The problem is the pdf is 'malformed'
I should add that if I save the query that was used to generate this xml and upload to APEX the rtf file that I provided here and I test the report, it runs fine. Also, when I use the add-in to create the rtf with the below xml file and view the pdf, it processes just fine as well. So I think the "pieces" are correct.
I am using Oracle BI Publisher Template Builder for Word 10.1.3.4.1 (Build 130)
Thanks for having a look. I posted this here (even though it's related to BI Publisher) because I feel like the problem is with APEX_UTIL.get_print_document .... If the administrators feel this is better posted in another forum, let me know.
Regards.
============================================================================================
xml file :
============================================================================================
<ROWSET>
<ROW>
<PL_ID>1</PL_ID>
<PL_DESC>Yield</PL_DESC>
</ROW>
<ROW>
<PL_ID>2</PL_ID>
<PL_DESC>Dealer markup</PL_DESC>
</ROW>
<ROW>
<PL_ID>3</PL_ID>
<PL_DESC>Dealer Premium</PL_DESC>
</ROW>
<ROW>
<PL_ID>4</PL_ID>
<PL_DESC>Flats</PL_DESC>
</ROW>
</ROWSET>
========================================================================================================
rtf file:
========================================================================================================
{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f36\froman\fcharset238\fprq2 Times New Roman CE;}
{\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}{\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;\red231\green243\blue253;}{\stylesheet{\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 Normal;}{\*
\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb
\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid10303210 Table Grid;}}{\*\rsidtbl \rsid10303210}
{\*\generator Microsoft Word 10.0.6854;}{\info{\title This is a simple test}{\author g001131}{\operator g001131}{\creatim\yr2009\mo11\dy22\hr15\min38}{\revtim\yr2009\mo11\dy22\hr15\min41}{\version1}{\edmins3}{\nofpages1}{\nofwords17}{\nofchars97}
{\*\company JPMorgan Chase & Co.}{\nofcharsws113}{\vern16393}{\*\password 00000000}}{\*\xmlnstbl }\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0
\widowctrl\ftnbj\aenddoc\grfdocevents0\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot10303210 \fet0
{\*\wgrffmtfilter 013f}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang
{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7
\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {\insrsid10303210 This is a simple test
\par }\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trhdr\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid7238448\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth4428\clcbpatraw17 \cellx4320\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
\clcbpat17\cltxlrtb\clftsWidth3\clwWidth4428\clcbpatraw17 \cellx8748\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid7238448 {\b\insrsid10303210 Pl Id}{\insrsid10303210\charrsid10303210 \cell }{
\b\insrsid10303210 Pl Desc}{\insrsid10303210\charrsid10303210 \cell }\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid10303210 \trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trhdr\trbrdrt
\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10
\trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid7238448\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb
\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth4428\clcbpatraw17 \cellx4320\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
\clcbpat17\cltxlrtb\clftsWidth3\clwWidth4428\clcbpatraw17 \cellx8748\row }\trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv
\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid7238448\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl
\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4428\clshdrawnil \cellx4320\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
\cltxlrtb\clftsWidth3\clwWidth4428\clshdrawnil \cellx8748\pard \ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid7238448 {\field\flddirty{\*\fldinst {\cf9\insrsid10303210\charrsid10303210 FORMTEXT }{
\cf9\insrsid10303210\charrsid10303210 {\*\datafield 8001000000000000055465787431000246200000000000103c3f666f722d656163683a524f573f3e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Text1}{\*\ffdeftext F }{\*\ffstattext
<?for-each:ROW?>}}}}}{\fldrslt {\cf9\lang1024\langfe1024\noproof\insrsid10303210\charrsid10303210 F }}}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\field\flddirty{\*\fldinst {\insrsid10303210\charrsid10303210 FORMTEXT }{
\insrsid10303210\charrsid10303210 {\*\datafield 80010000000000000554657874320005504c5f49440000000000093c3f504c5f49443f3e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Text2}{\*\ffdeftext PL_ID}{\*\ffstattext <?PL_ID?>}}}}
}{\fldrslt {\lang1024\langfe1024\noproof\insrsid10303210\charrsid10303210 PL_ID}}}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\insrsid10303210 \cell }{\field\flddirty{\*\fldinst {\insrsid10303210\charrsid10303210 FORMTEXT }{
\insrsid10303210\charrsid10303210 {\*\datafield 80010000000000000554657874330007504c5f4445534300000000000b3c3f504c5f444553433f3e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Text3}{\*\ffdeftext PL_DESC}{\*\ffstattext
<?PL_DESC?>}}}}}{\fldrslt {\lang1024\langfe1024\noproof\insrsid10303210\charrsid10303210 PL_DESC}}}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\field\flddirty{\*\fldinst {\cf9\insrsid10303210\charrsid10303210 FORMTEXT }{
\cf9\insrsid10303210\charrsid10303210 {\*\datafield 8001000000000000055465787434000220450000000000103c3f656e6420666f722d656163683f3e0000000000}{\*\formfield{\fftype0\ffownhelp\ffownstat\fftypetxt0{\*\ffname Text4}{\*\ffdeftext E}{\*\ffstattext
<?end for-each?>}}}}}{\fldrslt {\cf9\lang1024\langfe1024\noproof\insrsid10303210\charrsid10303210 E}}}\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\insrsid10303210 \cell }\pard
\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 {\insrsid10303210 \trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10
\trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid7238448\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt
\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4428\clshdrawnil \cellx4320\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10
\cltxlrtb\clftsWidth3\clwWidth4428\clshdrawnil \cellx8748\row }\pard \ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid10303210
\par
\par }}
===========================================================================================
PROCEDURE DEFINITION
===========================================================================================
procedure test_send_attachment1 is
l_id number;
l_document blob;
v_data clob;
v_fmt clob;
begin
select xml_file_clob, rtf_layout_clob
into v_data, v_fmt
from profitauto.xml_test1
where xml_id = 10;
l_document :=
apex_util.get_print_document(p_report_data => v_data
,p_report_layout => v_fmt
,p_report_layout_type => 'rtf'
,p_document_format => 'pdf');
l_id :=
apex_mail.send(p_to => [email protected]
,p_from => '[email protected]'
,p_subj => 'test_send_attachment1'
,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 => 'mydocument.pdf'
,p_mime_type => 'application/pdf');
end test_send_attachment1;Anyone?
-
Create collection from query with bind variable
Apex 4.0.2
Per Joel Re: Collection with bind variable the apex_collection.create_collection_from_query_b supports queries containing bind variable references (:P1_X) but I am not sure how to use this feature, the documentation doesn't have an example, just the API signature for the overloaded version has changed.
If the query contains 2 bind variable references to session state (:P1_X and :P1_Y), can someone please show an example of what to pass in for the p_names and p_values parameters to the API?
Thanks
procedure create_collection_from_query_b(
-- Create a named collection from the supplied query using bulk operations. The query will
-- be parsed as the application owner. If a collection exists with the same name for the current
-- user in the same session for the current Flow ID, an application error will be raised.
-- This procedure uses bulk dynamic SQL to perform the fetch and insert operations into the named
-- collection. Two limitations are imposed by this procedure:
-- 1) The MD5 checksum for the member data will not be computed
-- 2) No column value in query p_query can exceed 2,000 bytes
-- Arguments:
-- p_collection_name = Name of collection. Maximum length can be
-- 255 bytes. Note that collection_names are case-insensitive,
-- as the collection name will be converted to upper case
-- p_query = Query to be executed which will populate the members of the
-- collection. If p_query is numeric, it is assumed to be
-- a DBMS_SQL cursor.
-- example(s):
-- l_query := 'select make, model, caliber from firearms';
-- apex_collection.create_collection_from_query_b( p_collection_name => 'Firearm', p_query => l_query );
p_collection_name in varchar2,
p_query in varchar2,
p_names in wwv_flow_global.vc_arr2,
p_values in wwv_flow_global.vc_arr2,
p_max_row_count in number default null)
;VANJ wrote:
Apex 4.0.2
Per Joel Re: Collection with bind variable the apex_collection.create_collection_from_query_b supports queries containing bind variable references (:P1_X) but I am not sure how to use this feature, the documentation doesn't have an example, just the API signature for the overloaded version has changed.
If the query contains 2 bind variable references to session state (:P1_X and :P1_Y), can someone please show an example of what to pass in for the p_names and p_values parameters to the API?Not tried it, but guessing something like
apex_collection.create_collection_from_query_b(
p_collection_name => 'foobar'
, p_query => 'select f.foo_id, b.bar_id, b.baz from foo f, bar b where f.foo_id = b.foo_id and f.x = to_number(:p1_x) and b.y = :p1_y'
, p_names => apex_util.string_to_table('p1_x:p1_y')
, p_values => apex_util.string_to_table(v('p1_x') || ':' || v('p1_y'))) -
Report Performance with Bind Variable
Getting some very odd behaviour with a report in APEX v 3.2.1.00.10
I have a complex query that takes 5 seconds to return via TOAD, but takes from 5 to 10 minutes in an APEX report.
I've narrowed it down to one particular bind. If I hard code the date in it returns in 6 seconds, but if I let the date be passed in from a parameter it takes 5+ minutes again.
Relevant part of the query (an inline view) is:
,(select rglr_lect lect
,sum(tpm) mtr_tpm
,sum(enrols) mtr_enrols
from ops_dash_meetings_report
where meet_ev_date between to_date(:P35_END_DATE,'DD/MM/YYYY') - 363 and to_date(:P35_END_DATE,'DD/MM/YYYY')
group by rglr_lect) RPV
I've tried replacing the "to_date(:P35_END_DATE,'DD/MM/YYYY') - 363" with another item which is populated with the date required (and verified by checking session state). If I replace the :P35_END_DATE with an actual date the performance is fine again.
The weird thing is that a trace file shows me exactly the same Explain Plan as the TOAD Explain where it runs in 5 seconds.
Another odd thing is that another page in my application has the same inline view and doesn't hit the performance problem.
The trace file did show some control characters (circumflex M) after each line of this report's query where these weren't anywhere else on the trace queries. I wondered if there was some sort of corruption in the source?
No problems due to pagination as the result set is only 31 records and all being displayed.
Really stumped here. Any advice or pointers would be most welcome.
Jon.Don't worry about the Time column, the cost and cardinality are more important to see whther the CBO is making different decisions for whatever reason.
Remember that the explain plan shows the expected execution plan and a trace shows the actual execution plan. So what you want to do is compare the query with bind variables from an APEX page trace to a trace from TOAD (or sqlplus or whatever). You can do this outside APEX like this...
ALTER SESSION SET EVENTS '10046 trace name context forever, level 1';Enter and run your SQL statement...;
ALTER SESSION SET sql_trace=FALSE;This will create a a trace file in the directory returned by...
SELECT value FROM v$parameter WHERE name = 'user_dump_dest' Which you can use tkprof to format.
I am assuming that your not going over DB links or anything else slightly unusual?
Cheers
Ben -
Problem with Bind Variable in 11.2
Hi
I have a slow statement with bind Variables. With literals it works fine. Is there a way to replace the bind by literal in advanced ? I use Release 11.2.0.2.3
Thank you904062 wrote:
I have a slow statement with bind Variables. With literals it works fine. Is there a way to replace the bind by literal in advanced ? I use Release 11.2.0.2.3This specific scenario is very much an exception to the rule - and you need to back your statement up with execution plans of the SQL with bind variables and with literals, and run stats that show the difference between these two execution plans.
See the {message:id=9360003} from the {forum:id=75} forum's FAQ for details on how to post a SQL performance tuning question. -
Query with bind variable, how can use it in managed bean ?
Hi
I create query with bind variable (BindControlTextValue), this query return description of value that i set in BindControlTextValue variable, how can i use this query in managed bean? I need to set this value in String parameter in managed bean.
ThanksPut the query in a VO and execute it the usual way.
If you need to, you can write a parameterized method in VOImpl that executes the VO query with the parameter and then call that method from the UI (as a methodAction binding) either through the managed bean or via a direct button click on the page.
Maybe you are looking for
-
Looking for an eMail app?
Here's my problem: I have 250 emails in one of my email accounts, over 700 in another (hotmail and yahoo are main ones) that I want to filter for all emails from someone and then do a select all and either delete them or move them. Every app I have f
-
How to decide when an a "wait for event action" is activated
Hi, In the attched example file (which is a part of my program)I have 3 basic stages, enclosed in a sequence structure: 1) I initialize the GUI buttons 2) I check the instruments in my system are opened and ready to run ("VSWR initialize vi")and issu
-
H.264 vs. mp4. and older codecs
So I'm pretty new to all this and I was wondering what the differences between between h.264 and all of the "other" codecs. I was watching a couple of samples of video of the exact same footage. One is h.264 and the other is mp4.(?) and I was running
-
My registered domain is www.peuterspeelzaalrisdam.nl/ When I upload with FTP iWeb is adding 'file' to my domain, so www.peuterspeelzaalrisdam.nl/file So nobody will find the site because of this added 'file' What can I do to change that???? Anybody s
-
Output of query results to users in AIX menu
We have users logging into AIX. Upon login they see menu options 1-xx. We would like a menu option to query the database and display the results on the user's screen. Thanks, Saira