HTML Graph using PL/SQL
hi,
is there a way to draw a graph about a dataset and mail it with Oracle PL/SQL?
Thanks for your help.
Just for fun, I took this data:
select d.dname, sum(e.sal) sal
from emp e join dept d using (deptno)
group by dname;
DNAME SAL
ACCOUNTING 8750
RESEARCH 10875
SALES 9400
3 rows selected.and put it into this format (the CSS rules at the top would ideally be defined in a separate stylesheet):
<html>
<head>
<title>Demo of bar chart in HTML</title>
<style type="text/css">
html {
background: #fdfdfe;
color: black;
font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif;
font-size: 10pt;
table, td, th {
text-align: left;
vertical-align: top;
background: white;
margin-top: 20px;
table {
border-color: #808090;
border-style: solid;
border-width: 1px;
th p, td p.bar {
padding: 2px 0px 2px 5px;
td p.bar {
color: white;
background-color: rgb(80,100,140);
</style>
</head>
<body>
<table><tbody>
<tr> <th align="left"><p>ACCOUNTING</p></th> <td> <p class="bar" style="width: 87.50ex;">8750</p> </td> </tr>
<tr> <th align="left"><p>RESEARCH</p></th> <td> <p class="bar" style="width: 108.75ex;">10875</p> </td> </tr>
<tr> <th align="left"><p>SALES</p></th> <td> <p class="bar" style="width: 94.00ex;">9400</p> </td> </tr>
</tbody></table>
</body>
</html>I put the result here.
How you generate that text and write it out to an email is another question, but it shouldn't be too hard.
Similar Messages
-
How to create dynamic HTML page using PL/SQL code in APEX.
hello,
I am woking on one APEX application in which i want to create one dynamic HTML page on button press using PL/SQL code.
ThanksIt is possible to create HTML page with dynamic content. One way would be creating hidden field (e.g. P1_HTML on page 1) with dynamic HTML and on button click you redirect to page 2 and pass P1_HTML item value to item P2_HTML on page 2. On page you must have PL/SQL region. You can then render your dynamic HTML with code:
htp.p(:P2_HTML);
Don use APEX URL for passing HTML value. Problem and solution is described here: http://blog.trent-schafer.com/2011/04/03/dont-pass-string-parameters-in-the-url-in-apex-its-a-bad-idea/
Edited by: MiroMas on 3.2.2012 3:20 -
Launch HTML Page using PL/SQL package
Hi,
Am trying to launch an HTML page in which i have used javascripting using
catridges htp.p
while registering the function , only in the HTML call i have given package.procedure name
are there any special parameters that i need to pass in the package.
How do i build the url of the page to display in the package?
the problem i am clicking on the function i am getting logged as the function is unable to find the right url i guessMOD_PLSQL is an Apache (Web Server) extension module that allows one to create dynamic web pages from PL/SQL packages and stored procedures. It was formerly called the Oracle PL/SQL Cartridge and OWA (Oracle Web Agent). So I guess, you are referring to the same.
As for UI development, why don't you use the Oracle Applications Framework [OAF]? That's the standard for any UI development in apps. As mentioned earlier, mod pl/sql code is not supported on R12, so why use it? Better have a look at OAF.
--Shiv -
How validate HTML using PL/SQL
Hi,
I try validate HTML using PL/SQL that user inputs.
I did create below function for that purpose
CREATE OR REPLACE
FUNCTION validate_html(
p_html IN VARCHAR2
) RETURN BOOLEAN
AS
l_comment XMLTYPE;
xml_parse_err EXCEPTION;
PRAGMA EXCEPTION_INIT (xml_parse_err , -31011);
BEGIN
l_comment := xmlType.createXML('<root><row>' || p_html || '</row></root>');
RETURN TRUE;
EXCEPTION WHEN xml_parse_err THEN
RETURN FALSE;
END;
Function works ok and return true if I run e.g.
BEGIN
IF validate_html('<p>Hello</p>') THEN
dbms_output.put_line('OK');
ELSE
dbms_output.put_line('Not valid HTML');
END IF;
END;
And return false if I enter not valid HTML like
BEGIN
IF validate_html('<p>Hello') THEN
dbms_output.put_line('OK');
ELSE
dbms_output.put_line('Not valid HTML');
END IF;
END;
But it return false also if I run below
BEGIN
IF validate_html('<p>Hello  </p>') THEN
dbms_output.put_line('OK');
ELSE
dbms_output.put_line('Not valid HTML');
END IF;
END;
Problem seems to be that   (there is ; in end but do not know how post it without forum convert that to space) witch is valid HTML for me.
I know that HTML is not XML, but can I use Oracle database XML functions for validating HTML?
How I should validate user inputted HTML?
I'm currently developing this using Oracle XE 11G database.
Regards,
JariNot an elegant way:
But try this.........
CREATE OR REPLACE FUNCTION validate_html (p_html IN VARCHAR2)
RETURN BOOLEAN AS
l_comment XMLTYPE;
xml_parse_err EXCEPTION;
PRAGMA EXCEPTION_INIT (xml_parse_err, -31011);
BEGIN
l_comment :=
xmlType.createXML (
'<root><row>'
|| CASE
WHEN INSTR (p_html, '&') > 0 THEN
UTL_I18N.escape_reference (p_html)
ELSE
p_html
END
|| '</row></root>');
RETURN TRUE;
EXCEPTION
WHEN xml_parse_err THEN
RETURN FALSE;
END;
SET DEFINE OFF
SET SERVEROUTPUT ON
BEGIN
IF validate_html ('<p>Hello') THEN
DBMS_OUTPUT.put_line ('OK');
ELSE
DBMS_OUTPUT.put_line ('Not valid HTML');
END IF;
END;
SET DEFINE OFF
SET SERVEROUTPUT ON
BEGIN
IF validate_html ('<p>Hello  </p>') THEN
DBMS_OUTPUT.put_line ('OK');
ELSE
DBMS_OUTPUT.put_line ('Not valid HTML');
END IF;
END;
Cheers,
Manik. -
Disable Html button in validation process using pl/sql
Hi,
I need to disable a html page button. It gets re-enabled afer a validation process is run on the page and errors for the form are returned. I need a way of writing a validation process using pl/sql returning boolean, that can disable the button again.
I've tried:
IF lname > 0 THEN
Return TRUE;
Else
htp.p('<script type="text/javascript">');
htp.p('document.getElementById("NEW_ENTRY").disabled=true');
htp.p('</script>');
Return FALSE;
End If;
The button id is NEW_ENTRY, but this is ignored and the buttons remains enabled.
Any ideas on how to change the code to work?You have to create after region process that will be triggered on some condition.
htp.p('
<script type="text/javascript">
document.getElementById("NEW_ENTRY").disabled="true";
</script>
'); -
Using pl/sql to access non-apex HTML items on page
how would i use pl/sql to access html items on a page. the items are not apex items.
i want to loop through a set of html items on the page and do a database update on these values. the method i am using to distinguish these items from others on the page is using a custom attribute of type. i am then going to use the id as the primary key for the database.
using javascript i can traverse through all items however i require to do it in pl/sql. i realise that i could use javascript to put all values in one apex hidden field but this would be sloppy and i want to avoid doing this.Hello,
When a form submits the server never sees any custom attributes one way or the other, (this in any web environment) all anything on the server side will ever see is the value of the form item submitted. The only way to do what you want is to use javascript to collect the extra information and place it in a form item visible to APEX (a regular APEX Item).
The javascript route isn't a work around its the only way this will work the way you want. In the product itself we use custom attributes in an htmldb: namespace so the attribute does looks like htmldb:something="value", (you should make your own namespace don't use htmldb:)
I recommend using the namespace on your attributes instead of just shoving it in there as it will be closer to valid html or xhtml, it will still fail validation but at least you have the argument that "Hey xhtml is xml and xml allows for custom namespaces and custom attributes for that namespace so it's still good xml" not that I've ever used the argument or anything.
Carl
Message was edited by:
Carl Backstrom -
Using a SQL for Oracle in Microsoft Excel Query
I am having the most difficult time (in fact, I can't get it to work) trying to use an SQL I created in Toad for Oracle. It works fine in Toad for Oracle...gives me all the data I need. I am trying to use it in Excel for users that don't know SQL or Oracle so they can use the query to extract data they need for Charts, Graphs, etc.
Here is the SQL code from Toad for Oracle:
/* Formatted on 2006/09/22 11:42 (Formatter Plus v4.8.6) */
SELECT a_compl_summary.incident_number, a_compl_summary.case_number,
a_compl_summary.part_sequence, a_compl_summary.part_number,
a_compl_summary.lot_number, a_compl_summary.alert_date,
a_compl_summary.entry_date, a_compl_summary.NAME,
a_compl_summary.MONTH, a_compl_summary.product_family,
a_compl_summary.complaint, a_compl_summary.reportable,
a_compl_summary.product_returned, a_compl_summary.case_desc,
a_compl_summary.failure_invest_desc, a_compl_summary.lhr_search,
a_compl_summary.root_cause, a_compl_summary.corrective_action,
a_compl_summary.region,
rp_qa_reported_device_codes.reported_device_code,
rp_qa_reported_device_codes.reported_dev_clarification,
rp_qa_reported_device_codes.reported_dev_code_desc,
rp_qa_patient_codes.patient_code,
rp_qa_patient_codes.patient_code_clarif,
rp_qa_patient_codes.patient_code_severity,
rp_qa_patient_codes.description
FROM chsuser.a_compl_summary,
chsuser.rp_qa_patient_codes,
chsuser.rp_qa_reported_device_codes
WHERE ( (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= :date1
AND a_compl_summary.entry_date <= :date2
AND ( a_compl_summary.product_family LIKE :pf1
OR a_compl_summary.product_family LIKE :pf2
OR a_compl_summary.product_family LIKE :pf3
OR a_compl_summary.product_family LIKE :pf4
OR a_compl_summary.product_family LIKE :pf5
AND (a_compl_summary.region = :r1)
AND ( a_compl_summary.NAME = :c1
OR a_compl_summary.NAME = :c2
OR a_compl_summary.NAME = :c3
OR a_compl_summary.NAME = :c4
OR a_compl_summary.NAME = :c5
AND (a_compl_summary.complaint = :yorn)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl1
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl2
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl3
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl4
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl5
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
:dc1
AND (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
)Can someone help me...maybe point out what I'm doing wrong.
Note: I also tried creating this query in Microsoft Query (the simple way) and when I first create it...it works...But then if I go back in to edit the query, and refresh the query or try to Return data to Excel, it gives me a ORA-00936 error message.
Why it works when I first create the query in Excel, I don't know. But I have to validate the queries I'm creating (SQL or not) and I can't validate it if every time I go into edit the query (which may have to happen; that's why I have to fix this before I can submit my validation).
Anyway, any help would be greatly appreciated.Okay, I know I'm replying to my own threads here...but I want to add a little bit more information again.
I was successful in figuring out that changing the :criteria to a ? worked.
I tested this on 1 criteria at a time. Adding one more scenario ? at at time.
It only worked up until about 3 scenarios of each criteria.
Then when I refreshed the query in Microsoft Excel Query, I got an "out of memory" error, and then it ended up just erasing the SQL I had been using.
Here's the SQL I had where it gave me this error. Am I possibly just making Excel work too hard? It just doesn't make sense because Toad for Oracle handled it in like 4 seconds. Which brings me back to an intial question I had. Can Excel use Toad for Oracle somehow?
Here's the code:
SELECT a_compl_summary.incident_number, a_compl_summary.case_number,
a_compl_summary.part_sequence, a_compl_summary.part_number,
a_compl_summary.lot_number, a_compl_summary.alert_date,
a_compl_summary.entry_date, a_compl_summary.NAME,
a_compl_summary.MONTH, a_compl_summary.product_family,
a_compl_summary.complaint, a_compl_summary.reportable,
a_compl_summary.product_returned, a_compl_summary.case_desc,
a_compl_summary.failure_invest_desc, a_compl_summary.lhr_search,
a_compl_summary.root_cause, a_compl_summary.corrective_action,
a_compl_summary.region,
rp_qa_reported_device_codes.reported_device_code,
rp_qa_reported_device_codes.reported_dev_clarification,
rp_qa_reported_device_codes.reported_dev_code_desc,
rp_qa_patient_codes.patient_code,
rp_qa_patient_codes.patient_code_clarif,
rp_qa_patient_codes.patient_code_severity,
rp_qa_patient_codes.description
FROM chsuser.a_compl_summary,
chsuser.rp_qa_patient_codes,
chsuser.rp_qa_reported_device_codes
WHERE ( (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
AND (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= ?
AND a_compl_summary.entry_date <= ?
AND ( a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
OR a_compl_summary.product_family LIKE ?
AND (a_compl_summary.region = ?)
AND ( a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
OR a_compl_summary.NAME = ?
AND (a_compl_summary.complaint = ?)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
)) -
Footer navigation using pl/sql - substitution strings
Hi
I want to make a footer navigation (a BLAF like footer with the same captions and links that appear in the Tabs and the Navigation Bar) using a PL/SQL region. The code I want to use should work for any HTML DB application.
The procedure could be defined like this:
PROCEDURE prb_footer_navigation( p_application_id VARCHAR2
, p_page_id VARCHAR2
, p_session_id VARCHAR2);
p_application_id will be used to get the caption and links of the specific application and p_page_id will be used to know which tab is selected.
I'm using this query in the procedure:
SELECT t.tab_text caption
, t.tab_target link
, t.tab_sequence num
FROM flows_010600.wwv_flow_toplevel_tabs t
WHERE t.flow_id = p_application_id
ORDER BY t.tab_sequence
(the user has been granted select from flows_010600.wwv_flow_toplevel_tabs)
The problem is:
tab_target has substitution strings like '&XXX.' or '&PX_XXX.', so how can I get the real link with resolved substitution strings using pl/sql?
Something like function_resolve_string(p_string, p_session_id) would be appreciated...
Thanks in advance!A.U.,
Have you considered looking at how the navigation bar gets onto your page by examining the page template? You'll find something like this in the body section:
<table width="100%" cellpadding="0" cellspacing="0" border="0" summary="">
<tr>
<td valign="top" class="t1Logo">#LOGO#</td>
<td align="right" valign="top">#NAVIGATION_BAR#</td>
</tr>
</table>Just copy and paste that onto the end of the body section, or into the footer section of the template, although the footer might not support all the same substitution patterns.
If that's the kind of result you have in mind, do the same thing for the (html) tables that contain #PARENT_TAB_CELLS# and #TAB_CELLS#. I don't guarantee this will work, but it's worth experimenting with.
Scott -
How to download a SOAP attachment using pl/sql
Gurus,
I have a custom pl sql application that is web services based. The custom pl sql application invokes the external web services and updates Oracle Field Service application.
One of the new requirements is to get the signatures from SOAP Attachments (a binary file) and attach it to Field Services transactions in Oracle.
Does anyone has an example of how to download the SOAP attachment file from web service using pl/sql.
The pl sql program uses UTL_HTTP to access web services.
Much Thanx.I think you may be in the wrong forum, but anyways...
What I think your looking for is the htp.print('insert html here'); function. It's plsql, and writes out html to the web server that calls it.
if you search for htp.print you should find loads of examples.
hope this helps.
Merv. -
How to open a htmlwebpage by using pl/sql?
my problem is how to open/invoke a existing webpage by using pl/sql.Because I want to do a authentication function,and write a procedure to varify the user ID and password.If they are valid,a welcome webpage can display,otherwise a eror message/webpage will be invoked.
My question is how to display the error message to the webpage or to open a webpage which display the error message by using pl/sql.I think you may be in the wrong forum, but anyways...
What I think your looking for is the htp.print('insert html here'); function. It's plsql, and writes out html to the web server that calls it.
if you search for htp.print you should find loads of examples.
hope this helps.
Merv. -
How to generate formated (defined position) text and image using pl/sql and
Hello,
I need to use pl/sql to create a dynamic html page (or image , if possible) with defined positions for text and bar code. It is necessary because the page will be printed and it should be able to be read by one other process , OCR, that needs to have all the data in defined positions.
Any suggestion are welcome.
Thanks in advance,
EmilioI don't think it's that easy. Notice that if you put the insert into an actual pl/sql block, you don't get the correct column pointer anymore.
BEGIN insert into bob(col1, col2) values (123.12, 12345.12); END;
ERROR at line 1:
ORA-01438: value larger than specified precision allows for this column
ORA-06512: at line 1
Richard -
Devloping graphs using pure java without applets and swings
Hi Guys
i want to devlop bar graphs,pie charts,line graphs using pure java.i don't want to use applets and swings..does any body help on this asap..
IT'S VERY URGENT
cheers
ANANDGo to
http://java.sun.com/docs/books/tutorial/information/download.html#OLDui
and get: Creating a User Interface (AWT Only) Archive (tut-OLDui.zip) -
Syntax for calling html page in PL/SQL package
Hi,
I'm trying to call html page (stored on server) in my pl/sql package!
I have already create html page in pl/sql package code and it's works fine.
Now create better html page (interface design) and stored on server. I would like to call that stored html page in my pl/sql package.
What is syntax for calling html page in PL/SQL or could you suggest me some literature.
In first option I had created ces and stored it on server. Then I call it in pl/sql package like htp.p('<link rel="stylesheet" href="\download\table_style.css" type="text/css">');
I try someting like that for calling html page but it doesn't works.
htp.p('<link rel="form" href="\download\interface.htm" type="text/html">');
Does anyone know syntax for calling html page in pl/sql?!?
Thanks!hello
I normally use htp.anchor(URL,linkname);
it works
ammar sajdi
www.e-ammar.com/Oracle.htm -
Problem using MS SQL Server JDBC Driver
I am trying to use MS SQL Server JBDC driver with JDeveloper9i. I followed the steps mentioned in the document
http://otn.oracle.com/products/jdev/howtos/bc4j/bc_psqlserverwalkthrough.html
Still I am getting the following error message
Error initializing data-source 'SQLTestDS': DriverManagerDataSource driver 'com.microsoft.jdbc.sqlserver.SQLServerDriver' not found
What could be the reason?Did anybody run into similar issue?
Thanks in advance.
RCI assume from your message that you are attempting to
deploy your application into OC4J - you're probably
implicitly using the inbuilt OC4J if your using JSPs.
If so, try placing the jdbc jars into the <JDEVHOME>\lib directory
and referencing them from the j2ee\home\application.xml
file:
use lines like:
<library path="../../../lib/msbase.jar" />
regards, Karl -
Getting the schema using Oracle SQL Developer 1.5.1
I need to generate a report in CSV/XLS format using Oracle SQL Developer 1.5.1 to get the schema details
in the below format.
Table Name: XXXXXXXXX
Table Space Name: XXXXXXXXXXXXXXX
Structure :
Field Name Data Type Size
Xxxxxxxx xxxxxx xxxxx
Xxxxxxxx xxxxxx xxxxx
Xxxxxxxx xxxxxx xxxxx
Xxxxxxxx xxxxxx xxxxx
Field level constraint:
Xxxxxxxxxxxxxxxxxx
Table Level Constraint:
Xxxxxxxxxxxxxxxxxx
Indexes:
Index Name Column Name(s) Table space name
Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
Xxxxxxxx xxxxxxxxx xxxxxxxxxxxx
Sequence Number:
Xxxxxxxxxxxxxxxx
Triggers:
Xxxxxxxxxxxxxxxxxx
I am using a query to do that, but I cannot run more than one queries in the Create Report Dialog.
I went to the Menu->View->Reports. In that, I chose User Defined Reports, created a new folder called Schema Detail and in that a report named Schema Detail. I right click on that report, choose Edit option, Create Report Dialog opens.
In the Create Report Dialog, I chose the option Script for Value of Style.
In the SQL column I enter a query "select * from table_names". But, if I enter another query after that, it does not run and reports an error "SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - SQL command not properly ended" Cause: Action: "
I end the first query with a semi colon, but it does not work.
The queries run fine in a SQL Worksheet. There, I can terminate the first query with a semi colon and enter the second query. Then, I run both of them together so that result-set of second query appears after the second.
Am I doing something wrong? Can someone please advise on how to get the information I need?
Thanks a lot.You can do it in SQL Worksheet because you are running a script. You could run the script in SQL*Plus, and even start it from a bat/cmd file.
Or if you want this as a User Defined Report, you might make it a PL/SQL style report. Here, all output is done through DBMS_OUTPUT.PUT or DBMS_OUTPUT.PUT_LINE. You can output HTML tags or plain text. I have an example in my paper for ODTUG Kaleidoscope 2009.
Maybe you are looking for
-
Passing data from a background job to RFC calls in different App server
The program i am working on can be explained in the following steps: Step A- We use a standard program that is executed as a background job and the standard program obtains some data for a particular scenario. Step B - The job(standard program) durin
-
How to find max value in single row
i would like to know that, how can i display maximum value among several values in a single row of table example : i have to get value 5 among 1 2 3 4 5 values of same row.
-
Is there a way to sync my nano back to itunes
My computer crashed and I lost my iTunes library, including all of the personal music that I put on my IPOD Nano. I want to put more music on my nano, but want to keep what is on there now. Is there a way to sync my nano back to ITunes?
-
dear gurus, we are using oracle 10g1, with rhas 4e5, where on clients end it is forms 6i with patch 17 now we set in the begining startup time 2048MB SGA size...we found we need to increase more we try to increase from EM web based but give us proble
-
PB will not run on battery-RePost
Sorry, but I posted this under the battery and power section w/o a response. A coworkers 12" PB will not run off the battery. As soon as she removes the power cord it shuts off. New working battery was purchased and used. Any ideas? Thanks