Sending query result as html email
hi,
I have requirement to send query result as html emial to user, is there a possibility to send it?
database is 11.2.3
thanks,
7Z
Google is your friend
http://oracle-base.com/articles/misc/email-from-oracle-plsql.php
https://www.google.nl/search?q=send+email+oracle+database+11g
Similar Messages
-
Send BW query results as HTML email from ABAP program
I have published a code sample for sending BW query results as HTML email from ABAP program. if you have any questions or clarification, please post them here.
the same can be accessed from this link.
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b7658119-0a01-0010-39a9-b600c816f370
Regards
Raja
Message was edited by: Durairaj Athavan RajaOK forget about my earlier post.
do the following changes.
declare the following variables:
data: xtext type standard table of solix .
DATA: atta_sub TYPE sood-objdes .
after the call of FM SCMS_STRING_TO_FTEXT add the following code.
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = text
IMPORTING
EP_SOLIXTAB = xtext .
and after the following statement
document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = text
i_length = conlengths
i_subject = subject ).
add the following code
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'htm'
i_attachment_subject = atta_sub
i_att_content_hex = xtext.
now you will have results both in the body as well as attachment. (this is for test you can remove one of them )
Regards
Raja -
Converting Query results into HTML email
Hi,
I am using oracle 11g. I' m using the following procedure to send out html emails from a static query in the procedure and it works fine. I wanted to make it dynamic and pass the sql query as a parameter to procedure and build the html tags based on the query. Any thoughts?
CREATE OR REPLACE PROCEDURE html_sql_results
is
v_rows clob;
v_header clob;
cursor v_cursor is
select SR_NO,STATE,DUE_DT,PROCESS_DT,STATUS,DAY_NO,SEQ_NO
from T_TABLE;
BEGIN
v_header := '<table border=1>
<tr style=''background:#8DB3E2''>
<td><p><b>SR_NO</b></p></td>
<td><p><b>STATE</b></p></td>
<td><p><b>DUE_DT</b></p></td>
<td><p><b>PROCESS_DT</b></p></td>
<td><p><b>STATUS</b></p></td>
<td><p><b>DAY_NO</b></p></td>
<td><p><b>SEQ_NO</b></p></td>
</tr>';
v_rows := Null;
FOR i in v_cursor
LOOP
v_rows := v_rows ||
'<tr>
<td> <p>' || I.SR_NO||'</p></td>
<td> <p>' || I.STATE||'</p></td>
<td> <p>' || I.DUE_DT ||'</p></td>
<td> <p>' || I.PROCESS_DT ||'</p></td>
<td> <p>' || I.STATUS||'</p></td>
<td> <p>' || I.DAY_NO ||'</p></td>
<td> <p>' || I.SEQ_NO||'</p></td>
</tr> ';
END LOOP;
if v_rows is not null then
v_rows:= v_header ||v_rows ||' </table> ' ;
dbms_output.put_line(v_rows);
email_results(v_rows);
end if ;
end ;
/A possible way :
SQL> var result clob
SQL> DECLARE
2
3 ctx dbms_xmlgen.ctxHandle;
4 qry varchar2(2000) := 'SELECT * FROM hr.employees WHERE department_id = :1';
5
6 xsl xmltype := xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7 <xsl:output method="html"/>
8 <xsl:template match="/ROWSET">
9 <table border="1">
10 <tr style="background:#8DB3E2">
11 <xsl:for-each select="ROW[1]/*">
12 <td><p><b><xsl:value-of select="name()"/></b></p></td>
13 </xsl:for-each>
14 <xsl:apply-templates/>
15 </tr>
16 </table>
17 </xsl:template>
18 <xsl:template match="ROW">
19 <tr><xsl:apply-templates/></tr>
20 </xsl:template>
21 <xsl:template match="ROW/*">
22 <td><p><b><xsl:value-of select="."/></b></p></td>
23 </xsl:template>
24 </xsl:stylesheet>');
25
26 res clob;
27
28 BEGIN
29
30 ctx := dbms_xmlgen.newContext(qry);
31 dbms_xmlgen.setBindValue(ctx, '1', 90);
32 dbms_xmlgen.setNullHandling(ctx, dbms_xmlgen.EMPTY_TAG);
33 dbms_xmlgen.setXSLT(ctx, xsl);
34
35 :result := dbms_xmlgen.getXML(ctx);
36 dbms_xmlgen.closeContext(ctx);
37
38 --dbms_output.put_line(res);
39
40 END;
41 /
PL/SQL procedure successfully completed.
SQL> print result
RESULT
<table border="1"><tr style="background:#8DB3E2"><td><p><b>EMPLOYEE_ID</b></p></
td><td><p><b>FIRST_NAME</b></p></td><td><p><b>LAST_NAME</b></p></td><td><p><b>EM
AIL</b></p></td><td><p><b>PHONE_NUMBER</b></p></td><td><p><b>HIRE_DATE</b></p></
td><td><p><b>JOB_ID</b></p></td><td><p><b>SALARY</b></p></td><td><p><b>COMMISSIO
N_PCT</b></p></td><td><p><b>MANAGER_ID</b></p></td><td><p><b>DEPARTMENT_ID</b></
p></td><tr><td><p><b>100</b></p></td><td><p><b>Steven</b></p></td><td><p><b>King
</b></p></td><td><p><b>SKING</b></p></td><td><p><b>515.123.4567</b></p></td><td>
<p><b>17/06/03</b></p></td><td><p><b>AD_PRES</b></p></td><td><p><b>24000</b></p>
</td><td><p><b></b></p></td><td><p><b></b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>101</b></p></td><td><p><b>Neena</b></p></td><td><p><b>Kochhar</b></p></td><td><p><b>NKOCHHAR</b></p></td><td><p><b>515.123.4568</b></p></td><td><
p><b>21/09/05</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></t
d><td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr
<tr><td><p><b>102</b></p></td><td><p><b>Lex</b></p></td><td><p><b>De Haan</b></p></td><td><p><b>LDEHAAN</b></p></td><td><p><b>515.123.4569</b></p></td><td><p><
b>13/01/01</b></p></td><td><p><b>AD_VP</b></p></td><td><p><b>17000</b></p></td><
td><p><b></b></p></td><td><p><b>100</b></p></td><td><p><b>90</b></p></td></tr></
tr></table>Typically, XSLT stylesheets may be stored in the database too, so that you can modify and use different presentation templates without touching the code. -
Error occurred while sending query result: 'java.lang.NullPointerException'
I am doing end to end scenario from SQL server to File
JDBC --XI -- File
I am getting the following Error while monitoring the sender CC in RWB
"Error occurred while sending query result: 'java.lang.NullPointerException'
Please Help !!Hi,
To see the Adapter Error log, try:
http://<XiServerHostName>:<J2EE-Port>/MessagingSystem
Try viewing the Audit Log for each message (Newspaper Icon)
Regards,
Amitabha -
Error while sending query result
Hi all,
I am working on a JDBC-XI-IDoc scenario. In my sending JDBC adapter configuration, i have given the Query SQL statement as <b>SELECT * FROM SAP_PROMOTION</b> and Update SQL statement as: <b><TEST></b>
But when i go to adapter monitor, i am seeing an error as follws:
<b>Error: Sending query result failed with com.sap.aii.af.service.cpa.impl.exception.CPALookupException: Couldn't retrieve binding for the given channelId: Binding:CID=875514bc047b3557a5b53dfb5ef4babe; - retry
last retry interval started 10:54:09 2006-05-25
length 60,000 secs</b>
Can anybody help me how to solve this problem.
Regards,
DivijaDivija,
Am not sure if this is the exact cause for your problem, but would anyways suggest that you take a look at it,
<i>classes12.zip is not compatible with JDK 1.4.</i>
From the note : <b>831162</b>
Oracle JDBC Driver (classes12.zip / classes12.jar) Deadlocks
<b>Q: I have deployed the Oracle classes12.zip / classes12.jar JDBC driver as per the instructions in the XI Configuration Guide.
Unfortunately, I frequently notice hanging database connections. A thread dump taken according to the instructions in note 710154 shows one or more blocking JDBC Sender/Reciver threads and optionally that the JVM has detected a deadlock.
A: The Oracle classes12.zip / classes12.jar driver is compatible with Java 1.2 and Java 1.3 only, but not with Java 1.4. Please upgrade to a current driver (ojdbc14.jar), which does support the Java 1.4 JVM you are using.
Please make sure that you remove classes12.zip / classes12.jar from aii_af_jmsproviderlib.sda prior to adding the new driver as per the instructions in the answer to question #1 above as you will get a class name collision otherwise (all JARs from aii_af_jmsproviderlib.sda are loaded into the same class loader and the driver class name of both driver versions is the same).
Before deploying the updated driver, ensure that the new version is still compatible with your Oracle database server release. For details, please refer to the release notes provided by Oracle.</b>
Regards,
Bhavesh -
How to pass query result to HTML table?
Hi,
i want to get the query result in HTMl table instead of Display Grid. how to do it? i searched in help, it suggests use icommand to do this. but i dont know how to pass the select query result to HTML table.. please help me.
-senthilHi Senthil,
You can create an icommand query. You can then use the icommand retrieval methods to capture and manipulate the query data.
(http://help.sap.com/saphelp_xmii115/helpdata/en/Applet_Reference_Details/iCom
mand_Reference.htm)
Basically what we did was, use the getColumnCount() and getRowCount() methods, once you have these two numbers you can set two for loops and use String getValue(int ColID, int RowID) , within the for loops you can generate the inner html content and write the values either in a html table or html form (which is what we did). This seems to work well, I'm still playing around with it and may post this approach on sdn by end of this week.
Mahwish -
I'm looking for a more efficient way to convert a query result into an HTML table so that I can paste it into an email. The procedure in sqldeveloper (version 3.1.07) is just too clunky and involves too many keystrokes and mouse clicks. And you can't save the HTML to the clipboard. (I'm talking about the "Export..." action here.)
Am I missing something? Are there any alternatives?
Thanks!... but sqlplus is so last millenium....
Seriously? I'm from the last millennium too, nevertheless I don't consider myself out of date
SQL*PLUS is still my first choice when I have to run a script. I'ts behaviour is reliably the same whereever my script is executed. I would never trust a script that needs another tool to be executed.
Generating a HTML-mail is IMHO out of scope for a database tool. It's a feature I would expect in a BI tool that specializes on reporting.
Regards
Marcus -
Download BW Query results in HTML format
On a daily basis, I need to get BW query results exported to an HTML extract file on the BW server. The HTML file will then be transferred to a Windows server for use in a dashboard view by a third party developed portal. The query has an input variable for period.
What is the best/simplest method for scheduling an existing BW query to run on a daily basis to produce an HTML extract / download file to the BW server file system?
We are currently on BW 7.01 SP6. We just completed a technical upgrade from BW3.5, but did not do a functional upgrade.
I have read through many postings but have been unable to find a solution. I have reviewed RSCRM_BAPI u2013 no html format.
Any help would be greatly appreciated.
Thanks,
Mark NortonHello Mark...
Amer is right. You can create a broadcast setting to daily sends your
query as MHTML format.
You can send to your e-mail but there is a possibility to save on KM and CM repository.
There is a little explanation on the link below:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5c6b686a-0901-0010-8aab-c4d0e5a093a7?quicklink=index&overridelayout=true
To create a broadcast setting, open the query via Query Designer.
Click "Query" -> "Publish" -> "BEx Broadcaster"
While you are creating the broadcast, there is a "Output Format" option.
There is MHTML.
I hope you find this information useful.
Thanks
Edward -
How to send query results from BW to R/3 abap program
Hi,
I have to bring in query results from BW into a abap program written in R/3...can anyone help me on how to accomplish this(BW to R/3) please...i was thinking if reporting agent or broadcasting should help but i dont know how to get started.
Please help.
Thank you so much.Hi Vijay,
As i know, you can send data from BW to Flat file or into any table in BW or to BW application server only.
You need 3rd party to send data to different server.
You can use
1. Tcode : RSCRM_BAPI to download query values/results into a table or into a flat file. OR
2. You can use Infospokes to generate files from ODS/CUBE/master data objects to flat files(local/application server) or to a table.
3. Using information broadcasting we can send mail(dont know much options), but i dont think generation of file possible.
You need to trnasfer generated file from BW to R/3 and load into R/3 using BDC or LSMW(if data is low).
I think, you can also use RFC function modules to read data from BW to R/3, plz check with ABAPer.
Hope it Helps
Srini -
Is it possible to send report results as an email attachment in BW3.x ?
Hi Friends,
I have a requirement wherein I need to automate the process to run the report via Reporting Agent..and also to send the results as an e-mail attachment.
Is it possible to do so in BW 3.x..?
I was trying to see if I can run the report using the Reporting Agent Settings, using the Web Templates tab. However I did not see any follo-up actions available for Web templates, but found so for the Exceptions.
Can you please help and let us know if there is a way to do that and what options are available..?
Thank You
Sri lz70d73.1 version.
try to follwong links
loginto rsa1
u will see tab of REPORTING AGENT, press that tab.
u need to schedule the jobs as u schedule process chains,
select ur query, make the time arrangement, select output format,
output type i.e.
http://help.sap.com/saphelp_nw04/helpdata/en/45/67bd3cad649f5ce10000000a114084/content.htm
Reporting Agent Configuration
After the two steps configuration
1 - configure the agent settings for web templates
2 - scheduling package which is a reporting agent scheduler
In RSRAJ Starts a Reporting Agent Job
SAP show-mw the folow information...
All Reporting Agent settings processed
My Questions is ---Where the system save the query data ????
In RSRAM Reporting Agent Monitor in Schedule --> Execution Target --> i have information of aplcation Server. -
Send Query Results to Application server in CSV format
HI All,
I need to schedule a query on a regular basis and send the results to Apllication server in csv format(rows will be more than 65,000).
I tried RSCRM_BAPI transaction but i think it has lot of restrictions like, cannot use texts, calculated keyfigures, etc. so cannot use this.
cannot use Infospoke since there are calculated keyfigures in the query.
Information Broadcasting is not setup in my system
Tried WRITEQUERY but it only send the results to Spool, special handling is needed to move the data from spool to Appl. server.
is there any other way i can achive this, is it even possible?
Thanks,
S.B.I dont know if this helps.
1)You can save the file as a normal CSV file on your desktop.
2) and Based on the ABAP code using ( OPEN DATASET and CLOSE DATASET statements) You can put your file into the application server
but i am not sure if you can use this methodilogy for an automated and continous process
Regards
satish -
Sending query results to an excel file
hai friends,
Can any one help me out in sending the results of a query to an excel file once i press a button on my jsp.
I need to display the results of the query and has to send those results to the excel file.
Thanks and regards,
ravikiranThe solution is simple and the trick lies in setting the Content Type of the response and producing the output.
If we remember, while coding in servlets, one needs to set the content type on the response object. For outputting in Excel format, the content type has to be set as "application/vnd.ms-excel"
Once this is done, the servlet knows that it has to produce the output in MS Excel Sheet.
You can query the databsae and loop over your record set and output it in any manner you like.
eg
<!-- Printing the Row Headers-->
out.println("Header1 \t Header 2 \t Header3");
<!-- printing the actual values from database-->
while(rs.next()){
out.println(rs.getString(1) + "\t" + rs.getString(2) + "\t" + rs.getString(3));
Hopefully this will work for all of you.
Thanks -
XML query results in HTML form parameter
Hi,
I would like insert records from a query result (raw XML) into HTML form tags, using the XSL stylesheet. Here is the code I am trying to use, but obviously it is not working.
<INPUT TYPE="hidden" NAME="te_hb_strdEntryId"
VALUE="<xsl:value-of select="ID"/>">
Are there any other options to put a result of a query in a hidden tag, using XSL?
Any help will be appriciated.<INPUT TYPE="hidden" NAME="te_hb_strdEntryId"
VALUE="<xsl:value-of select="ID"/>">
The correct syntax would be:
<INPUT TYPE="hidden" NAME="xxx">
<xsl:attribute name="VALUE">
<xsl:value-of select="ID"/>
</xsl:attribute>
however, there is a shortcut syntax
when you are using XPath expressions
in literal attribute values:
XSLT attribute value templates. They are
XPath expressions inside curly braces.
So, you can achieve your desired result
with the shorter form:
<INPUT TYPE="hidden" NAME="xxx" VALUE="{ID}">
as well. -
Send query results to a file using Toad
Hello,
I have a select statement that generates xml rows, and I need to send the results to a file. I am using TOAD VI. The rows generate ok but when I right click and choose the save as option all I end up with is an empty file.
Is there a way I can just send the results directly to a file instead of to the screen?
Thanks.user11293056 wrote:
Would you happen to know of a website that shows how to create an xml file using SQL*Plus?
Thanks.A search of asktom.oracle.com for the following phrase found a couple interesting pages:
table(xmlsequence(cursor
On such page is this one:
http://asktom.oracle.com/pls/asktom/f?p=100:11:1074646661177911::::P11_QUESTION_ID:4061080732051
As an experiment, you might take a look at the output of the following (replace SELECT * FROM MY_TABLE_HERE with your SQL statement):
SELECT
FROM
TABLE(XMLSEQUENCE(CURSOR(
SELECT
FROM
MY_TABLE_HERE
)));Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
Sending pics results in duplicate email msgs
I use Aperture 3.4.3 and mac mail on my macbook pro 13". I select several pics from my aperture library and select share by email. I add several email addresses in the To or CC lines and when I send the message each person receives two exact emails. Thanks for the help.
Hi eLeaner22,
If you can spare the time would you mind filing this as a
bug, the behavior you are experiencing is something that I have
seen occur on many occasions. You can report this issue via the
Adobe
Captivate Feature Request/Bug Report Form
The more people report issues with sending results via email
the more chance we have of getting it fixed in a future version.
Regards - Mark
Maybe you are looking for
-
If i specify ?config=webutil, then the error i got in internet explorer is: We were unable to return you to the page you were viewing. Internet Explorer has stopped trying to restore this website. It appears that the website continues to have a probl
-
Unable to connect to Internet via Airport Express - 'cannot contact server'
I'm unable to connect to the internet via my Airport Express. I'm using OS 10.3.9, and had the same setup with no problems at a previous address, but with a different modem from the same ISP. My AE is connected - the light is green - and my mac is co
-
Airport Extreme will not connect to Internet
Just purchased an Airport Extreme Base Station (AEBS) to upgrade old Netgear router. Netgear was working perfect with both wired and wireless internet. My ISP is a rural internet high-speed wireless company. It is not DSL/Cable or Satellite, requi
-
Qosmio G50-10J: How to replace the Optical Disc Drive (ODD)?
Hello there, the optical drive of my Qosmio G 50 is not working properly anymore, it reads only some movie-DVDs, but sadly no videogameDVDs at all, so I cannot instal any games. The warranty has already expired too. So I wanted to ask if it is possib
-
Can I install Photoshop, Illustrator, Fireworks, InDesign and Dreamweaver on Mac?