Apex_mail.send function or procedure?
All,
Perhaps I'm just tired an not understanding something, but I'm looking that the apex_mail.send "procedure" in ApEx's internal help, and it's calling the block a procedure. But it has a return value, so it must be a function. Then in the examples I see it used as a stand alone procedure, not a part of an expression. Am I missing something?
Dan
Dan,
Describe the package in SQL*Plus:SQL> desc apex_mail
PROCEDURE ADD_ATTACHMENT
Argument Name Type In/Out Default?
P_MAIL_ID NUMBER IN
P_ATTACHMENT BLOB IN
P_FILENAME VARCHAR2 IN
P_MIME_TYPE VARCHAR2 IN
PROCEDURE BACKGROUND
Argument Name Type In/Out Default?
P_ID NUMBER IN
P_SMTP_HOSTNAME VARCHAR2 IN DEFAULT
P_SMTP_PORTNO VARCHAR2 IN DEFAULT
PROCEDURE PUSH_QUEUE
Argument Name Type In/Out Default?
P_SMTP_HOSTNAME VARCHAR2 IN DEFAULT
P_SMTP_PORTNO VARCHAR2 IN DEFAULT
PROCEDURE PUSH_QUEUE_BACKGROUND
PROCEDURE SEND
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY VARCHAR2 IN
P_BODY_HTML VARCHAR2 IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
PROCEDURE SEND
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY CLOB IN
P_BODY_HTML CLOB IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
PROCEDURE SEND
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY VARCHAR2 IN
P_BODY_HTML VARCHAR2 IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
P_REPLYTO VARCHAR2 IN
PROCEDURE SEND
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY CLOB IN
P_BODY_HTML CLOB IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
P_REPLYTO VARCHAR2 IN
FUNCTION SEND RETURNS NUMBER
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY VARCHAR2 IN
P_BODY_HTML VARCHAR2 IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
FUNCTION SEND RETURNS NUMBER
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY CLOB IN
P_BODY_HTML CLOB IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
FUNCTION SEND RETURNS NUMBER
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY VARCHAR2 IN
P_BODY_HTML VARCHAR2 IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
P_REPLYTO VARCHAR2 IN
FUNCTION SEND RETURNS NUMBER
Argument Name Type In/Out Default?
P_TO VARCHAR2 IN
P_FROM VARCHAR2 IN
P_BODY CLOB IN
P_BODY_HTML CLOB IN DEFAULT
P_SUBJ VARCHAR2 IN DEFAULT
P_CC VARCHAR2 IN DEFAULT
P_BCC VARCHAR2 IN DEFAULT
P_REPLYTO VARCHAR2 IN
SQL>You see both functions and procedures named send. So it depends on how you want to call them.
Scott
Similar Messages
-
Help with Mutating Error / Trigger / APEX_MAIL.SEND
Hello:
I am trying to get the apex_mail.send function working when a user submits a new record. I've taken the code from the canned Issue Tracker application code and tried to retrofit it to my tables. However I keep receiving a mutating error on line 11 (line 11 bolded below):
-- Create a trigger that will send notification after
-- the submission of each new idea on the IDEAS table.
create or replace trigger IDEAS_EMAIL
AFTER
insert or update on IDEAS
for each row
begin
IF (INSERTING AND :new.manager_name IS NOT NULL)
OR
(UPDATING AND (:old.manager_name IS NULL OR :new.manager_name != :old.manager_name) AND :new.manager_name IS NOT NULL) THEN
FOR c1 IN
(SELECT fname, lname, email
FROM ideas_users
WHERE fname||' '||lname = :new.manager_name)
LOOP
IF c1.email IS NOT NULL THEN
FOR c2 IN
(SELECT MANAGER_NAME, FULL_TEXT, SUMMARY, ID, SUBMITTED_BY, SUB_DATE
FROM IDEAS
WHERE ID = :new.ID)
LOOP
APEX_MAIL.SEND(
p_to => c1.email,
p_from => c1.email,
p_body =>
'This is a test message. ' ||chr(10)||
p_subj => 'test email subject');
END LOOP;
END IF;
END LOOP;
END IF;
end;
I've also tried setting the following line to the primary key field in the user table and inserting that value into the main table but I still get the same error message.
WHERE fname||' '||lname = :new.manager_name)
Thanks in advance for any help.Let me get this straight..
You are inserting a row into a table, and when you insert the row, you are going to send an e-mail t o the manager who owns this row. In the data you are inserting, is the e-mail address of the manager, right?
David has provided the answer for you.. Use the :NEW.Email value instead of creating a cursor and all that.. Unless you have a need to e-mail multiple people of the record insert..
Thank you,
Tony Miller
Webster, TX
On the road of life...There are 'windshields', and there are 'bugs'
(splat!)
"Squeegees Wanted" -
APEX_MAIL.SEND from a pl/sql function
I have created a pl/sql function, in the database, in which I would like to use APEX_MAIL.SEND to send out emails.
When I try to compile I get the following errors:
Compilation failed,line 10 (08:44:32)
PLS-00307: too many declarations of 'SEND' match this callCompilation failed,line 10 (08:44:32)
PL/SQL: Statement ignored
Here is the relavent code. Line 10 is the line where I have APEX_MAIL.SEND
LOOP
APEX_MAIL.SEND (
P_TO => email_rec.TO_EMAIL,
P_FROM => email_rec.FROM_EMAIL,
P_BODY => email_rec.BODY,
P_BODY_HTML => email_rec.BODY,
P_SUBJ => email_rec.SUBJECT );
I am in APEX version 3.0.0.00.20
I can send mail from a APEX application procedure. The function I am having trouble with is one that can be accessed under the SQL Workshop --> Object Browser --> Functions.
Other functions work fine.
Thanks.Have a look at the following thread Re: HTMLDB_MAIL.SEND Cursor for loop
It might be a problem of your data types you have defined in email_rec. Eg. do you have a CLOB for SUBJECT?
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/ -
APEX_MAIL.SEND() not seen executing MY procedure from TOAD
Hi,
I have a procedure that calls APEX_MAIL.SEND and works fine when executed from within the app or in the APEX Workshop window.
Trying to execute MY procedure from an Oracle job we get an error unknown procedure APEX_MAIL.SEND
anyone have this problem?Hello,
Why don't you use utl_smtp package if you are wanting to send email from pl/sql?
If you look at the help for APEX_MAIL its says:
APEX_MAIL
You can use the APEX_MAIL package to send an email from an Oracle Application Express application. This package is built on top of the Oracle supplied UTL_SMTP package. Because of this dependence, the UTL_SMTP package must be installed and functioning in order to use APEX_MAIL.
So APEX_MAIL will only work within a valid apex session and it won't be available to a toad session .
Cheers,
Paul. -
Send CURSOR to Function/Store Procedure
Hi to all,
I want to send a cursor to a function or store procedure.
I got 3 tables with the same structure, I made a cursor for update and other stuff but I want to save some data to a text file, so I want to make a function or sotre procedure that I can send the cursor and the function/store procedure make the Job (save the data to a text file) with any tables.
Can I do That?
Any sample or documentation?
Thanks in advance.HLopezRD wrote:
Hi to all,
I want to send a cursor to a function or store procedure.
Any sample or documentation?Do you want to send an actual cursor or just the data?
Either way, a reference cursor might do the job for you. Check out reference cursors in the Oracle on-line documentation. You can pass them to and from procedures and functions, and they provide access to data in the database. -
Using APEX_MAIL from within a procedure invoked from DBMS_JOB
I have done a lot of googling and wasted a couple of days getting nowhere and would appreciate some help. But I do know that in order to use APEX_MAIL from within a DBMS_JOB that I should
"In order to call the APEX_MAIL package from outside the context of an Application Express application, you must call apex_util.set_security_group_id as in the following example:
for c1 in (
select workspace_id
from apex_applications
where application_id = p_app_id )
loop
apex_util.set_security_group_id(p_security_group_id =>
c1.workspace_id);
end loop;
I have created a procedure that includes the above (look towards the end)
create or replace procedure VACANCIES_MAILOUT
(p_application_nbr number,
p_page_nbr number,
p_sender varchar2)
AS
Purpose: Email all people registerd in MAILMAN [email protected]
with details of any new vacancies that started listing today.
Exception
when no_data_found
then null;
when others then raise;
l_body CLOB;
l_body_html CLOB;
l_vacancy_desc VARCHAR2(350);
to_headline varchar2(200);
to_org varchar2(100);
l_vacancies_desc varchar2(2000);
to_workspace_id number(22);
CURSOR vacancies_data IS
select DISTINCT v.headline to_headline,
ou.org_name to_org
from VACANCIES v,
Org_UNITS ou
where
ou.org_numb = v.Org_Numb
and v.public_email_sent_date is Null
Order by ou.org_name, v.headline;
BEGIN
BEGIN
FOR vacancies_rec in vacancies_data
-- build a list of vacancies
loop
BEGIN
l_vacancy_desc := '<br><b>' ||
vacancies_rec.to_org || '<br>' ||
vacancies_rec.to_headline || '</b><br>';
-- l_vacancy_desc :=
-- vacancies_rec.to_org || ' - ' ||
-- vacancies_rec.to_headline ;
l_vacancies_desc := l_vacancies_desc || l_vacancy_desc;
END;
END LOOP;
END;
l_body := 'To view the content of this message, please use an HTML enabled mail client.'||utl_tcp.crlf;
l_body_html :=
'<html>
<head>
<style type="text/css">
body{font-family: Verdana, Arial, sans-serif;
font-size:11pt;
margin:30px;
background-color:white;}
span.sig{font-style:italic;
font-weight:bold;
color:#811919;}
</style>
</head>
<body>'||utl_tcp.crlf;
l_body_html := l_body_html || l_vacancies_desc
|| '<p>-----------------------------------------------------------------------------------------------------------------</strong></p>'
||utl_tcp.crlf
|| '<p>The above new vacancies have been posted on the <strong>Jobs At Murdoch</strong> website.</p>'
||utl_tcp.crlf
||'<p>For futher information about these vacancies, please select the following link</p>'
||utl_tcp.crlf
||'<p> Jobs At Murdoch </p>'
||utl_tcp.crlf
||'<p></p>'
||utl_tcp.crlf;
l_body_html := l_body_html
||' Regards
'||utl_tcp.crlf
||' <span class="sig">Office of Human Resources</span>
'||utl_tcp.crlf;
for c1 in (
select workspace_id
from apex_applications
where application_id = 1901)
loop
apex_util.set_security_group_id(p_security_group_id => c1.workspace_id);
end loop;
apex_mail.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => l_body,
p_body_html => l_body_html,
p_subj => 'Jobs At Murdoch - new vacancy(s) listed');
update VACANCIES
set public_email_sent_date = trunc(sysdate,'DDD')
where public_email_sent_date is null;
commit;
END;
but still get the error
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle
System name: Linux
Node name: node
Release: 2.6.18-194.17.1.el5
Version: #1 SMP Mon Sep 20 07:12:06 EDT 2010
Machine: x86_64
Instance name: instance1
Redo thread mounted by this instance: 1
Oracle process number: 25
Unix process pid: 5092, image: (J000)
*** 2011-07-12 09:45:03.637
*** SESSION ID:(125.50849) 2011-07-12 09:45:03.637
*** CLIENT ID:() 2011-07-12 09:45:03.637
*** SERVICE NAME:(SYS$USERS) 2011-07-12 09:45:03.637
*** MODULE NAME:() 2011-07-12 09:45:03.637
*** ACTION NAME:() 2011-07-12 09:45:03.637
ORA-12012: error on auto execute of job 19039
ORA-20001: This procedure must be invoked from within an application session.
ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 290
ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 325
ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 367
ORA-06512: at "HRSMENU_TEST.VACANCIES_MAILOUT", line 94
ORA-06512: at line 1
Can someone please tell me what what stupid thing I am doing wrong? The procedure worked when invokded from SQL Workshop but fails in a DBMS_JOB.
much thanks PeterI think that might help...
http://www.easyapex.com/index.php?p=502
Thanks to EasyApex..
LK -
APEX_MAIL Send Results In A HTML Table
Apex 3.2
I have wriiten a procedure that sends an email with data from the apex_workspace_activity_log.
I would like to try and display this data in a table in the email.
Has anybody done this before ?
CREATE OR REPLACE PACKAGE BODY EFSAPX.p_monitor_page_times AS
procedure pr_checkelapsed(p_elapsed in number,
p_toemail in varchar2) is
v_text clob;
begin
wwv_flow_api.SET_SECURITY_GROUP_ID;
for x in (select
application_id,
application_name,
page_id,
elapsed_time
from
apex_workspace_activity_log
where
application_id = 103
and elapsed_time > p_elapsed
and trunc(view_date) > trunc(sysdate-1)
order by
elapsed_time desc)
loop
v_text := v_text || 'Application No: ' || x.application_id ||chr(10);
v_text := v_text || 'Application: ' || x.application_name ||chr(10);
v_text := v_text || 'Page Id: ' || x.page_id ||chr(10);
v_text := v_text || 'Elapsed Time: ' || x.elapsed_time ||chr(10);
v_text := v_text || utl_tcp.crlf;
end loop;
apex_mail.SEND(p_to => p_toemail,
p_from => '[email protected]',
p_body => v_text,
p_subj => 'Elapsed Time Metric Warning');
apex_mail.push_queue('localhost', 25);
end pr_checkelapsed;
END p_monitor_page_times;Cheers
GusAs Bas says, the actual HTML involved is very simple, and there's loads of documentation available for it.
I normally use SQL/XML to generate HTML fragments with embedded data:
select
xmlserialize(
content
xmlelement(
"table"
, xmlconcat(
xmlelement(
"tr"
, xmlconcat(
xmlelement("th", 'Application No')
, xmlelement("th", 'Application')
, xmlelement("th", 'Page ID')
, xmlelement("th", 'Elapsed Time')))
, xmlagg(
xmlelement(
"tr"
, xmlconcat(
xmlelement("td", application_id)
, xmlelement("td", application_name)
, xmlelement("td", page_id)
, xmlelement("td", elapsed_time)))
order by elapsed_time desc)))
indent size=2) html_table
from
apex_workspace_activity_log
where
application_id = :p_app_id
and elapsed_time > :p_elapsed
and trunc(view_date) > trunc(sysdate-1)This avoids a lot of tedious messing about with concatenation and/or substitution in PL/SQL code, and results in clean, valid HTML mark-up with all of the tags and any attributes in the right place. However as the <tt>apex_mail</tt> API docs note, the <tt>p_body_html</tt> parameter must be a full HTML document (and you'll probably need to include other content and styling as well as the table). It's a bit tedious to nest all of that structure into the query, so a combination of using Bas' template method for the basic HTML document structure and this SQL/XML query approach to generate the table structure with data would be a good idea.
I'm guessing from the <tt>wwv_flow_api.SET_SECURITY_GROUP_ID</tt> call that you intend to run this outside of an APEX session? Another option to consider is to create a public page in this app or as a standalone app in the workspace with this query as a report region using simplified page/report templates, and all of the required styling embedded in the page. The mail procedure can then use <tt>httpUriType.getCLOB</tt> to retrieve this page as a complete document that can be passed as <tt>p_body_html</tt> to <tt>apex_mail.send</tt>.
Note the requirement that each line in the content cannot exceed 1000 characters. Whatever method you use will have to have that built in to whatever template/queries are used (hence <tt>indent</tt> in the code above), or you'll have to process the content and insert CRLFs at appropriate points before calling <tt>apex_mail.send</tt>. -
Calling Oracle function and Procedure using OCCI with in C++ code
Could any body send me the sample code to create and execute Oracle function and Procedure using OCCI concept in C++?.
Edited by: 788634 on Aug 16, 2010 4:09 AMHi Vishnu,
Yes, sure, you can create a PL/SQL procedure, function, package, package body, etc. from within an OCCI application. I would say that, generally, this is not the sort of activity a typical client application would perform unless there is some initialization/installation processes that need to happen. In any case, here is a simple demo showing how to create a stand alone procedure (in a real application I would use a package and body) that returns a ref cursor. The ref cursor is just a simple select of two columns in the hr.countries sample table. Of course, there is no error handling, object orientation, etc. in this demo - I wanted to keep the code as short and as simple as possible to illustrate the concept.
Regards,
Mark
#include <occi.h>
#include <iostream>
using namespace std;
using namespace oracle::occi;
int main(void)
// occi variables
Environment *env;
Connection *con;
Statement *stmt;
ResultSet *rs;
// database connection information
string user = "hr";
string passwd = "hr";
string db = "orademo";
// sql to create the procedure which returns a ref cursor as out parameter
// should be run as hr sample user or in a schema that has select privilege
// on the hr.countries table and a synonym (countries) that points to the
// hr.countries table
string sqlCreate =
"create or replace procedure get_countries(p_rc out sys_refcursor) as "
"begin"
" open p_rc for"
" select country_id, country_name from countries order by country_name; "
"end;";
// pl/sql anonymous block to call the procedure
string sqlCall = "begin get_countries(:1); end;";
// create a default environment for this demo
env = Environment::createEnvironment(Environment::DEFAULT);
cout << endl;
// open the connection to the database
con = env->createConnection(user, passwd, db);
// display database version
cout << con->getServerVersion() << endl << endl;
// create statement object for creating procedure
stmt = con->createStatement(sqlCreate);
// create the procedure
stmt->executeUpdate();
// terminate the statement object
con->terminateStatement(stmt);
// now create new statement object to call procedure
stmt = con->createStatement(sqlCall);
// need to register the ref cursor output parameter
stmt->registerOutParam(1, OCCICURSOR);
// call the procedure through the anonymous block
stmt->executeUpdate();
// get the ref cursor as an occi resultset
rs = stmt->getCursor(1);
// loop through the result set
// and write the values to the console
while (rs->next())
cout << rs->getString(1) << ": " << rs->getString(2) << endl;
// close the result set after looping
stmt->closeResultSet(rs);
// terminate the statement object
con->terminateStatement(stmt);
// terminate the connection to the database
env->terminateConnection(con);
// terminate the environment
Environment::terminateEnvironment(env);
// use this as a prompt to keep the console window from
// closing when run interactively from the IDE
cout << endl << "ENTER to continue...";
cin.get();
return 0;
} -
Difference between function and procedure
Hi all,
Please send me the difference b/w functions and procedures.
Regards
dskumarA procedure may(1 or many) or may not return a
value,I have yet to see a procedure returning a value. Whilst it can pass out values using OUT and IN OUT parameters, it doesn't RETURN values.
A function always returns one value.A function may also include OUT and IN OUT parameters to pass back values but it's not recommended. -
Mail is Not sending thru Apex_mail_send Procedure
Hi ,
We have created a Leave application , when i entered the leave request its sending the mail to the approver.
But its not sending the mail. We thought that mail considered as a SPAM thats the reason the mail server should block the mail.
Procedure is
apex_mail.send(
p_to => :P111_APPROVE, ---- approver mail id
p_from => :p111_FROM, ---- default mail id
p_cc => :P111_ALT_APPROVER, --- alternate approver mail id
p_body => l_body, --- body we are declaring in a clob variable
p_body_html => l_body_html, --- body HTML same as BODY
p_subj => :p111_subject); --- Subject
apex_mail.push_queue(p_smtp_hostname => :P111_HOST, --- Here passing the HOST address
p_smtp_portno => :P111_PORT); --- here PORT address.Can anyone suggestion me how to slove this problem.
Regards,
Shan
Edited by: Shan on 3 Jun, 2010 2:12 PMHi,
I have passed the host and port number to push queue.
But when i checked the apex_mail_queue there is no data.
In apex_mail_log the data and content is there. SMTP error also NULL.
I am not clear about instance
My URL is : http://192.168.1.114:7777/pls/apex/
My Host address is : 192.168.1.114
Port Number is: 25
Pot number is comin from SELECT PORT_NO FROM COM_IP_ADDRESS;
Regards,
Shan -
Apex_mail.send / HTML formatting Ignored When Sent via Trigger
I have a PL/SQL procedure that sends a formatted email using the apex_mail.send procedure. This procedure works 100% perfectly if I run the procedure either from a scheduled job (using dbms_scheduler), or when I siimply call the procedure "ad hoc" from the APEX SQL Editor. However, when the exact same procedure gets invoked/called from a DB trigger, some of the formatting instructions get ignored with regards to font face and font size. I am stumped by this. Any ideas?
BTW, I'm using APEX 4.2.
Thanks in advanceSorry totally my fault - no issue at all... more a problem with the tester! users with an external email address are receiving the email it just seems when the email is sent from Apex standalone is appears in the inbox but when it is sent from within an iframe it is sent straight to the junk mail by the email client... still a little strange there is a difference in behaviour but at least it doesn't totally fail as I first thought.
-
Apex_mail.send p_cc format
Anyone else using the APEX mail send procedure and the p_cc parameter? From what I gather, it only accepts one email address, rather than say a semi-colon or comma delimited list of email addresses. Same can be said of p_bcc. I tried comma and semi-colon lists and they error out. Using the single address works.
I am hoping someone can prove to me that this can be a list. I want the ability of sending to many cc recipients without sending multiple emails.
Not much documentation on this, just that it is a VARCHAR2 value.
TIA,
BuzzHi Buzz,
They are comma-separated values.
I just sent this to myself from apex.oracle.com and it worked fine (using different e-mail addresses, obviously):
begin
apex_mail.send( p_to => '[email protected]',
p_from => '[email protected]',
p_cc => '[email protected],[email protected]',
p_subj => 'test',
p_body => 'test' );
end;Joel -
Sending an email with html tags in it using apex_mail.send
Hello,
I am using APEX_MAIL.SEND to send emails from my apex applications.
now I need the email body to have html features: bold, underline, colors etc.
If I use regular html tags, they show up in the email.
How can this be done?
Thanks
RaniHi, try
p_body_html
and it should display just fine :) -
Queryable Function or Procedure for a Chart?
I have a complex query that I use to generate different pie charts in APEX.
All that changes from one chart to another is the column that is being queried (i.e. OS, Platform, etc)
For maintainability I would rather have this be a single query w/ a method to substitute the value being queried upon.
Any suggestions for doing so? Is there some form of queryable function or procedure?
[Because of the way I list multiple charts per page, I would not want to just have a single chart for all values.]
Here is a sample query.
select link, os, decode(:P421_COUNT_BY,'CPUs',percent_cpu,percent) value
from (
select 'f?p=&FLOW_ID.:6:&SESSION.::::P1_OS:'||i.os link, i.os,
count(*) num,
round(count(*)*100/(sum(count(*)) over())) percent,
sum(nodes*nvl(cores,1)*nvl(cpus_per_node,1)) cpus,
round(sum(nodes*nvl(cores,1)*nvl(cpus_per_node,1))*100/(sum(sum(nodes*nvl(cores,1)*nvl(cpus_per_node,1))) over())) percent_cpu
from customers c, country_region_mapping m, systems i, oracle_versions ov
where c.country = m.country
and c.customer_id = i.customer_id
and ov.version(+)=i.oracle_version
and (:P421_SHOW='Yes' or (i.system_status='Production'))
and (:P421_NODES='BOTH' or :P421_NODES is null or (:P421_NODES='SINGLE' and i.nodes=1) or (:P421_NODES='RAC' and i.nodes>=2))
and (i.os=:P421_OS or :P421_OS is null or :P421_OS='All')
and (m.country=:P421_COUNTRY or :P421_COUNTRY is null or :P421_COUNTRY='All')
and (m.region=:P421_REGION or :P421_REGION is null or :P421_REGION ='All')
and (c.industry=:P421_INDUSTRY or :P421_INDUSTRY is null or :P421_INDUSTRY='All')
and (ov.major=:P421_ORACLE_RELEASE or :P421_ORACLE_RELEASE is null or :P421_ORACLE_RELEASE='All')
and i.os is not null
and i.os not in ('unknown','Not Sure')
group by os)
where decode(:P421_COUNT_BY,'CPUs',percent_cpu,percent) >= 1
order by decode(:P421_COUNT_BY,'CPUs',percent_cpu,percent) descHi Erik,
I wrote a blog post about generic charting a while back that you might (or might not!) find useful -
http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
Hope this helps,
John. -
Hi Friends,
My Question is : At what time we will use function and Procedure.? How i can prefer it?
Regards,
AnuFunctions are normally used for computations where as procedures
are normally used for executing business logic.
there can be many difference between stored procedures and functions
main are
1. function can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
If you have a function in which there are DML statements only then you can not call this function in a SQL query
for example
For example, if you have a function that is updating a table, you cannot call that function from a SQL query.
- select myFunction(field) from sometable; will throw error.
But you can do it through procedure.
I hope it is clear
Maybe you are looking for
-
How do I set up a share on my buffalo Linkstation Live 2 TB
Can anyone please help me? How do I set up a share with my Buffalo Linkstation live so that I can use it for my iTunes library?
-
Error in configuration of financial reporting in workspace web server
Hello, I met an issue few days ago, and impossible for me to correct... My installations are as following : Server A : Foundation Services Workspace Services EPMA + Calc Manager EAS Server B : Planning Worskpace Web Financial Reporting Server C : Wor
-
Database filled fields to a pdf form, how can i setup fields to receive ?
have a database that has a pdf form filler that can send filled fields to a form designed pdf, how can i setup fields to receive the specific fields ?
-
Google App Easter Egg - "Bells and Whistles"
I was posting something on Apple's Discussions about the change in the Google Mobile App - a poster was lamenting the change to the mobile-optimized format. I like the classic view better, was searching for a way to change it to that in the Settings
-
System Imaging Utility + Scripts to create a Netinstall
I need everyone's help on this one! We have an Xserve G5 server that is running Leopard Server 10.5.2. What we want to be able to do is Netinstall Windows's script to image a drive on a dual boot Mac Pro, meaning partition the drive for Mac and Windo