Generating XML using oracle10g (plsql)
Hi,
I have to generate XML using plsql, please somebody help me in this.
Query is as below.
First I need to select few columns COL1,COL2 AND COL3 from table let say TEMP1 on the basis of PK_ID.
this selected columns should be in XML document which I need to return as OUT parameter.
Now on the basis of COL1 fetched in the above query from TEMP table
I need to fetch all the columns COL4,COL5 AND COL6 from its child table let say TEMP2 on the basis of COL1.
Please suggest.
SQL> select dbms_xmlgen.getxml('select * from emp where deptno = 10')
2 from dual
3 /
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-81</HIREDATE>
<SAL>2450</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-81</HIREDATE>
<SAL>5000</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7934</EMPNO>
<ENAME>MILLER</ENAME>
DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
<JOB>CLERK</JOB>
<MGR>7782</MGR>
<HIREDATE>23-JAN-82</HIREDATE>
<SAL>1300</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
SQL> SY.
Similar Messages
-
How to append the declaration tags to generated xml using Xquery
Hi,
How to append the declaration tags to generated xml using Xquery.generated XML is like
<ROOT>
<CHILD1></CHILD1>
<CHILD2></CHILD2>
</ROOT>
Here I want to append the <?xml version="1.0" encoding="ISO-8859-1"?> and the result xml should be
<?xml version="1.0" encoding="ISO-8859-1"?>
<ROOT>
<CHILD1></CHILD1>
<CHILD2></CHILD2>
</ROOT>
Can anybody help to do this.
Thanks
ManiFirst assign this element to a temp variable
<ROOT>
<CHILD1></CHILD1>
<CHILD2></CHILD2>
</ROOT>
Now in XQuery expression create a new variable
<?xml version="1.0" encoding="ISO-8859-1"?>
$temp -
Hi All,
We have a situation as in where we have to generate a XML out of Oracle UCM. I want to know is there any way where i can generate XML using the reaultset of some query.
Any inputs will be useful..
Thanks.Hi!
In IdocScript, you can work with the resultset and generate XML as you want ....
You could also make your own java component that would generate XML.
Romain. -
Generating XML Tags in PLSQL using XMLELEMENT
Hi All,
I am trying to generate XML Tags using XMLELEMENT. Does anyone has an example for this. I have special characters in my DATA so the normal Concatenation does not work.........
Thanks In Advance.try select xmlelement("ELEMENT_NAME",column)
into var
from dual;
var must be defined as xmltype -
Generating XML using Varray or Pl/SQL table
I am trying to convert an old plsql procedure to generate XML data. The program is getting all the data to report from various sources to a pl/sql table.
Is there any way to directly convert data into xml from plsql table ??
Here is the plsql table defination
TYPE Emp_rec IS RECORD ( Batch_name VARCHAR2(240)
,Employee_name VARCHAR2(240)
,Employee_number VARCHAR2(240)
,Element_name VARCHAR2(240)
,Bee_value NUMBER
,Ele_scr_value NUMBER
TYPE emp_data IS TABLE OF Emp_rec
INDEX BY BINARY_INTEGER;
E emp_data;
And i am trying to get xml using following code:
FOR i IN E.FIRST.. E.LAST
LOOP
SELECT
XMLConcat (
XMLELEMENT(
"batch",
XMLFOREST(
E(i).Batch_name AS "Batch_name",
E(i).Employee_number AS "Employee_number",
E(i).Element_name AS "Element_name"
INTO l_xml
FROM dual;
end loop;
I am not sure whether this can actually be done or not. I have option to write the xml file manually to output ; but just wondering whether this method of getting xml is correct or not ? If yes, then how can we use plsql table data and merge it into a single XML file
Please let me know your views and opinions.
Thanks
AnkurI am trying to convert an old plsql procedure to generate XML data. The program is getting all the data to report from various sources to a pl/sql table.
Is there any way to directly convert data into xml from plsql table ??
Here is the plsql table defination
TYPE Emp_rec IS RECORD ( Batch_name VARCHAR2(240)
,Employee_name VARCHAR2(240)
,Employee_number VARCHAR2(240)
,Element_name VARCHAR2(240)
,Bee_value NUMBER
,Ele_scr_value NUMBER
TYPE emp_data IS TABLE OF Emp_rec
INDEX BY BINARY_INTEGER;
E emp_data;
And i am trying to get xml using following code:
FOR i IN E.FIRST.. E.LAST
LOOP
SELECT
XMLConcat (
XMLELEMENT(
"batch",
XMLFOREST(
E(i).Batch_name AS "Batch_name",
E(i).Employee_number AS "Employee_number",
E(i).Element_name AS "Element_name"
INTO l_xml
FROM dual;
end loop;
I am not sure whether this can actually be done or not. I have option to write the xml file manually to output ; but just wondering whether this method of getting xml is correct or not ? If yes, then how can we use plsql table data and merge it into a single XML file
Please let me know your views and opinions.
Thanks
Ankur -
How to generate XML usng java without using following.
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
XML to be generated is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<Modi xmlns:xsi="Modi/Modi1">
<docConfig>
<className>PO</className>
<classDesc>Purchase</classDesc>
<create>Y</create>
</docConfig>
<indexConfig>
<index sequence="1">
<shortName>PODATE</shortName>
<displayName>PO Date</displayName>
<type>date</type>
<length>10</length>
</index>
</indexConfig>
</upload>Two answers.
If you want to not use any of the XML-oriented classes, you can use a PrintWriter. Just code:
PrintWriter pw = new PrinteWriter(whatever);
pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
etc.If you want to use XML-oriented classes, but just not these 3 (can't imagine why), then use
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
instead of XMLSerializer and OutputFormat, and
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
instead of the DocumentImpl
Dave Patterson -
How do I generate XML using internal variables in a procedure
I know there is a way to generate XML inside a procedure by querying the database such as
SELECT XMLELEMENT("Emp",
XMLFOREST(e.employee_id, e.last_name, e.salary))
"Emp Element"
FROM employees e WHERE employee_id = 204;
Emp Element
<Emp>
<EMPLOYEE_ID>204</EMPLOYEE_ID>
<LAST_NAME>Baer</LAST_NAME>
<SALARY>10000</SALARY>
</Emp>
What I have unsuccessfully been trying to do is to basically do the same thing except using internal variables like
DECLARE
l_keytype CONTACTINFO.KEYTYPE%TYPE;
l_keyvalue CONTACTINFO.KEYVALUE%TYPE;
l_pricetag CONTACTINFO.PRICATEG%TYPE;
l_xmlout CLOB;
BEGIN
l_keytype := '1';
l_keyvalue := '3333';
l_pricetag := '10';
SELECT XMLELEMENT("ParamSet", .........................this is line 13
XMLFOREST(l_keytype as "keytype", l_keyvalue as "keyvalue", l_pricetag as "pricetag"))
"ParamSet Element"
INTO l_xmlout FROM DUAL;
DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmlout);
end;
What I'd like it to generate is
<ParamSet>
<KEYTYPE>1 </KEYTYPE>
<KEYVALUE>3333</KEYVALUE>
<PRICETAG>100</PRICETAG>
</ParamSet>
But what I get is a compile error
Error report:
ORA-06550: line 13, column 19: (line 13 is SELECT XMLELEMENT("ParamSet", )
PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
ORA-06550: line 13, column 1:
PL/SQL: SQL Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Also, I've been told that one issue with XMLFOREST is that if the value is null it won't generate the XML for it. Not good. I will still need the XML even if it is empty. Please help.Darn, Marc beat me. Here was my answer showing an alternative for returning an XMLType, since that is what the query returns as he said.
DECLARE
l_keytype VARCHAR2(5);
l_keyvalue VARCHAR2(5);
l_pricetag VARCHAR2(5);
l_xmlout CLOB;
l_xmltype XMLTYPE;
BEGIN
l_keytype := '1';
l_keyvalue := '3333';
l_pricetag := '10';
SELECT XMLELEMENT("ParamSet",
XMLFOREST(l_keytype as "keytype",
l_keyvalue as "keyvalue",
l_pricetag as "pricetag")).getClobVal()
INTO l_xmlout
FROM DUAL;
DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmlout);
SELECT XMLELEMENT("ParamSet",
XMLFOREST(l_keytype as "keytype",
l_keyvalue as "keyvalue",
l_pricetag as "pricetag"))
INTO l_xmltype
FROM DUAL;
DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmltype.getClobVal());
end;Here is a link to Oracle's on-line documentation
http://www.oracle.com/technetwork/indexes/documentation/index.html
so that you can pick your version and search for XMLElement and XMLForest to see their difference as well as listening to us. -
Generate xml using FOR XML PATH from table with hierarchy
I need to create xml from a table like:
EL1 EL2 EL3 Attr01 Attr02 Attr03 Attr04
E10, , ,a,b,c,d
E10,E1010, ,a,b,c,d
E10,E1010,E101010,a,b,c,d
E10,E1010,E101020,a,b,c,d
E10,E1010,E101030,a,b,c,d
E10,E1020, ,a,b,c,d
E10,E1020,E102010,a,b,c,d
E20, , ,a,b,c,d
E20,E2010, ,a,b,c,d
E20,E2010,E201010,a,b,c,d
E20,E2020, ,a,b,c,d
E20,E2020,E202010,a,b,c,d
E20,E2020,E202020,a,b,c,d
The hierarchy is EL1--EL2--EL3, and the 3 columns should be elements of xml;
The other for columns Attr01,Attr02,Attr03,Attr04 should be attributes of xml;
The actual table could have more than 500 rows(there are many values for El1,EL2,and EL3).
The expected xml should like:
<root>
<E10 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E1010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E101010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E101020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E101030 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E1010>
<E1020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E102010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E1020>
</E10>
<E20 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E2010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E201010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E2010>
<E2020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E202010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E202020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E2020>
</E20>
</root>
I create a sample Src table:
CREATE TABLE Src
EL1 VARCHAR(10),
EL2 VARCHAR(10),
EL3 VARCHAR(10),
Attr01 VARCHAR(10),
Attr02 VARCHAR(10),
Attr03 VARCHAR(10),
Attr04 VARCHAR(10)
GO
INSERT INTO Src
(EL1,EL2,EL3,Attr01,Attr02,Attr03,Attr04
SELECT 'E10','','','a','b','c','d'
UNION SELECT 'E10','E1010','','a','b','c','d'
UNION SELECT 'E10','E1010','E101010','a','b','c','d'
UNION SELECT 'E10','E1010','E101020','a','b','c','d'
UNION SELECT 'E10','E1010','E101030','a','b','c','d'
UNION SELECT 'E10','E1020','','a','b','c','d'
UNION SELECT 'E10','E1020','E102010','a','b','c','d'
UNION SELECT 'E20','','','a','b','c','d'
UNION SELECT 'E20','E2010','','a','b','c','d'
UNION SELECT 'E20','E2010','E201010','a','b','c','d'
UNION SELECT 'E20','E2020','','a','b','c','d'
UNION SELECT 'E20','E2020','E202010','a','b','c','d'
UNION SELECT 'E20','E2020','E202020','a','b','c','d'
GO
I tried to use FOR XML PATH to generate xml for the sample data. When the records increase to a few hundreds, it's not a good idea.
Here is my script:
SELECT
(SELECT Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101010'
FOR XML PATH('E101010'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101020'
FOR XML PATH('E101020'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101030'
FOR XML PATH('E101030'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E1010' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E1010'),TYPE
) AS 'node()'--1010
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E102010'
FOR XML PATH('E102010'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E1020' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E1020'),TYPE
) AS 'node()'--1020
FROM Src
WHERE EL1 = 'E10' AND (EL2 ='' AND EL3 ='')
FOR XML PATH('E10'),TYPE) 'node()'
,(SELECT Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E201010'
FOR XML PATH('E201010'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E2010' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E2010'),TYPE
) AS 'node()'--2010
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E202010'
FOR XML PATH('E202010'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E202020'
FOR XML PATH('E202020'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E2020' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E2020'),TYPE
FROM Src
WHERE EL1 = 'E20' AND (EL2 ='' AND EL3 ='')
FOR XML PATH('E20'),TYPE) AS 'node()'
FOR XML PATH(''),ROOT('root')
If I get a few hundreds of rows, how huge the script should be. Does anyone have better solution for this? Thanks.
TaowBob,
Thanks! And sorry for late feedback.
The XSD requires the xml structures like the following
<Schools>
<School01>Some school</School01>
<School02>Some other school</School02>
</Schools>
I have to use the number in the element name.
Right now I just use the nested FOR XML PATH, although I have to write thousand lines code.
Thanks anyway.
Tao
Tao -
Generate XML using package xmlgen
I have the following query:
select employ_id, last_name, first_name, salary from employ;
I need generate xml like this:
<row>
<employ>
<employ_id last_name="Dennis" First_name="david">1</employ>
<salary>6</salary>
</employ>
</row>
How can I get it using xmlgen package? Thanks.
nullNo, you will not be able to do that. The
problem is that the columns of the db table
are mapped to XML elements rather then
attributes. Your best bet at achieving your
goal is that after you get your xml document
from the XSU, you transform it using XSLT.
The Oracle Parser does include the xsl processor.
visar
ps.: Today, when using XSU's java API, you can directly get a DOM tree representation of the XML document, which then you can pass directly to the XSL processor and transform it; unfortunately, the PL/SQL API (i.e. xmlgen) doesn only return a string (i.e. lob) representation of the XML doc. So you have to use the PL/SQL Parser to parse it, get it in the DOM format, and only then can you transform it. The good news is that I was assured that in the future the XMLGEN will have a call to get the XML doc in DOM rep. -
Hi all,
How can I genrate a XML document using Java? What are the imports that I have to use? Also please tell me about JAXP and in what way it can be used to generate an XML
Please Help me with examples..
Thanks in advanceYou can generate xml with dom like this
try {
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document document = docBuilder.newDocument();
Element element = document.createElement("<your_tag_name>"); // creares tag
element.setAttribute("key", "value"); // adds an attribute to your tag
Text text = document.createTextNode("some text"); // creates "some text node"
element.appendChild(text); // adds text to our tag for ex. <your_tag_name>some text</your_tag_name>
CDATASection cdata = document.createCDATASection("cdata text");
element.appendChild(cdata); // appends it to element
document.appendChild(element); // if you want to add this element *** root element
// or
root.appendChild(element); // where root is another Element object
} catch (ParserConfigurationException e) {
e.printStackTrace();
} -
Generating xml using PL/SQL taking a lot of space in TEMP tablespace
We wrote a stored procedure that generate xml which will be stored in a CLOB column. Environment is 9i on Windows 2003.
The gnerated xml is about 800K. In the procedure there is one big cursor that will retrieve 200 records of 55 fields and many other small dynamic cursors that open and close here and there. The fields are pretty small. Biggest ones are like varchar2(30). The query for the big cursor does using union and need sorting.
Can anyone explain why it takes about 15G of TEMP tablespace to accomplish this job and is there a way to avoid this?The version is Enterprise Edition 9.2.0.1.0.
Below is the query.
SELECT ROWNUM + ( SELECT NVL(MAX(WQX_ACTIVITY_GEN_ID), 0) FROM WQX_ACTIVITY ) as WQX_ACTIVITY_GEN_ID
, A.ACTIVITYIDENTIFIER2 as ACTIVITY_IDENTIFIER
, (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242) as ORGANIZATION_NAME
, (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
, A.ACTIVITYTYPECODE as ACTIVITY_TYPE_CD
, A.ActivityMediaName as ACTIVITY_MEDIA_NAME
, A.ActivityMediaSubDivisionName as MEDIA_SUB_DIVISION
, A.ActivityStartDate as ACTIVITY_START_DATE
, CASE WHEN A.ActivityStartTime is not NULL THEN
substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
WHEN A.ActivityStartTime is NULL THEN ''
END as ACTIVITY_START_TIME
-- , substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00' as ACTIVITY_START_TIME
, A.ACTIVITYENDDATE as ACTIVITY_END_DATE
, CASE WHEN A.ACTIVITYENDTIME is not NULL THEN
substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00'
WHEN A.ACTIVITYENDTIME is NULL THEN ''
END as ACTIVITY_END_TIME
-- , substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00' as ACTIVITY_END_TIME
, A.TIMEZONECODE1 as TIME_ZONE_CD
, A.ActivityRelativeDepthName as RELATIVE_DEPTH_NAME
, NULL as DEPTH_HEIGHT_MEASURE
, NULL as DEPTH_HEIGHT_UNIT
, 111242 as MONITORING_LOC_ID
, A.ACTIVITYCOMMENTTEXT as COMMENT_
, A.SamplerName as SAMPLER_NAME
, A.ActivityArea as ACTIVITY_AREA
, A.ReportingRound as REPORTING_ROUND
, A.SamplePanel as SAMPLEPANEL
, A.DataIncludedinReport as DATA_INCLUDED_IN_REPORT
, A.FlowStatusIndicator as FLOW_STATUS_IND
, A.SampleChainOfCustody as SAMPLE_COC
, A.ActivitySeason as ACTIVITY_SEASON
, A.RunoffImpact as RUNOFF_IMPACT
, (111242) as MONI_LOC_ID
, (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
, 111242 as PROJECT_ID
, NULL as BIO_ASSEMB_SAMPLED_NAME
, NULL as BIO_TOXICITY_TEST_TYPE
, A.METHODIDENTIFIER1 as SAMPLE_COLLECT_METHOD_IDENTIFI
, A.METHODIDENTIFIERCONTEXT1 as SAMPLE_COLLECT_METHOD_CONTEXT
, A.METHODNAME1 as SAMPLE_COLLECT_METHOD_NAME
, NULL as SAMPLE_COLLECT_QUALIFIER_TYPE
, A.METHODDESCRIPTIONTEXT1 as SAMPLE_COLLECT_DESC
, A.SampleCollectionEquipmentName as SAMPLE_COLLECT_EQUIP_NAME
, A.SAMPLECOLLECTIONEQUIPMENTTXT as SAMPLE_COLLECT_EQUIP_DESC
, A.METHODNAME2 as SAMPLE_PREP_METHOD_NAME
, A.METHODIDENTIFIER2 as SAMPLE_PREP_METHOD_IDENTIFIER
, A.METHODIDENTIFIERCONTEXT2 as SAMPLE_PREP_METHOD_CONTEXT
, NULL as SAMPLE_PREP_QUALIFIER_TYPE
, A.METHODDESCRIPTIONTEXT1 as SAMPLE_PREP_DESC
, A.SampleContainerTypeName as SAMPLE_CONTAINER_TYPE
, A.SampleContainerColorName as SAMPLE_CONTAINER_COLOR
, A.ChemicalPreservativeUsedName as CHEM_PRESERVATIVE_USED
, A.ThermalPreservativeUsedName as THERMAL_PRESERVATIVE_USED
, A.SAMPLETRANSPORTSTORAGEDESC as SAMPLE_TRANS_STORAGE
, A.AnalysisStartTime as AnalysisStartTime
, A.AnalysisEndTime as AnalysisEndTime
, A.MethodSpeciationName as MethodSpeciationName
, A.ResultLaboratoryCommentCode as ResultLaboratoryCommentCode
, A.UnidentifiedSpeciesIdentifier as UnidentifiedSpeciesIdentifier
FROM TMP_CHEMACTIVITYRESULTS A
WHERE A.SUBMISSION_ID = 111242
AND A.ACTIVITYIDENTIFIER2 NOT IN
( SELECT ACTIVITY_IDENTIFIER FROM WQX_ACTIVITY )
UNION
SELECT X.WQX_ACTIVITY_GEN_ID as WQX_ACTIVITY_GEN_ID
, A.ACTIVITYIDENTIFIER2 as ACTIVITY_IDENTIFIER
, (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242) as ORGANIZATION_NAME
, (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
, NVL(A.ACTIVITYTYPECODE, (SELECT MAX(ACTYP_CD) FROM REF_ACTIVITY_TYPE WHERE TO_CHAR(ACTYP_UID) = TO_CHAR(X.ACTIVITY_TYPE_CD))) as ACTIVITY_TYPE_CD
, NVL(A.ActivityMediaName, X.ACTIVITY_MEDIA_NAME) as ACTIVITY_MEDIA_NAME
, NVL(A.ActivityMediaSubDivisionName, X.MEDIA_SUB_DIVISION) as MEDIA_SUB_DIVISION
, NVL(A.ActivityStartDate, TO_CHAR(X.ACTIVITY_START_DTTM, 'YYYY-MM-DD')) as ACTIVITY_START_DATE
, CASE WHEN A.ActivityStartTime is not NULL THEN
substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
WHEN A.ActivityStartTime is NULL THEN ''
END as ACTIVITY_START_TIME
-- , NVL((substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'), TO_CHAR(X.ACTIVITY_START_DTTM, 'HH24:MI:SS')) as ACTIVITY_START_TIME
, NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'YYYY-MM-DD')) as ACTIVITY_END_DATE
, NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'HH24:MI:SS')) as ACTIVITY_END_TIME
, NVL(A.TIMEZONECODE1, X.TIME_ZONE_CD) as TIME_ZONE_CD
, NVL(A.ActivityRelativeDepthName, X.RELATIVE_DEPTH_NAME) as RELATIVE_DEPTH_NAME
, X.DEPTH_HEIGHT_MEASURE as DEPTH_HEIGHT_MEASURE
, X.DEPTH_HEIGHT_UNIT as DEPTH_HEIGHT_UNIT
, NVL(111242, X.MONITORING_LOC_ID) as MONITORING_LOC_ID
, NVL(A.ACTIVITYCOMMENTTEXT, X.COMMENT_) as COMMENT_
, NVL(A.SamplerName, X.SAMPLER_NAME) as SAMPLER_NAME
, NVL(A.ActivityArea, X.ACTIVITY_AREA) as ACTIVITY_AREA
, NVL(A.ReportingRound, X.REPORTING_ROUND) as REPORTING_ROUND
, NVL(A.SamplePanel, X.SAMPLEPANEL) as SAMPLEPANEL
, NVL(A.DataIncludedinReport, X.DATA_INCLUDED_IN_REPORT) as DATA_INCLUDED_IN_REPORT
, NVL(A.FlowStatusIndicator, X.FLOW_STATUS_IND) as FLOW_STATUS_IND
, NVL(A.SampleChainOfCustody, X.SAMPLE_COC) as SAMPLE_COC
, NVL(A.ActivitySeason, X.ACTIVITY_SEASON) as ACTIVITY_SEASON
, NVL(A.RunoffImpact, X.RUNOFF_IMPACT) as RUNOFF_IMPACT
, (111242) as MONI_LOC_ID
, (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
, 111242 as PROJECT_ID
, X.BIO_ASSEMB_SAMPLED_NAME as BIO_ASSEMB_SAMPLED_NAME
, X.BIO_TOXICITY_TEST_TYPE as BIO_TOXICITY_TEST_TYPE
, NVL(A.METHODIDENTIFIER1, X.SAMPLE_COLLECT_METHOD_IDENTIFI) as SAMPLE_COLLECT_METHOD_IDENTIFI
, NVL(A.METHODIDENTIFIERCONTEXT1, X.SAMPLE_COLLECT_METHOD_CONTEXT) as SAMPLE_COLLECT_METHOD_CONTEXT
, X.SAMPLE_COLLECT_METHOD_NAME as SAMPLE_COLLECT_METHOD_NAME
, X.SAMPLE_COLLECT_QUALIFIER_TYPE as SAMPLE_COLLECT_QUALIFIER_TYPE
, NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_COLLECT_DESC) as SAMPLE_COLLECT_DESC
, NVL(A.SampleCollectionEquipmentName, X.SAMPLE_COLLECT_EQUIP_NAME) as SAMPLE_COLLECT_EQUIP_NAME
, NVL(A.SAMPLECOLLECTIONEQUIPMENTTXT, X.SAMPLE_COLLECT_EQUIP_DESC) as SAMPLE_COLLECT_EQUIP_DESC
, NVL(A.METHODNAME2, X.SAMPLE_PREP_METHOD_NAME) as SAMPLE_PREP_METHOD_NAME
, NVL(A.METHODIDENTIFIER2, X.SAMPLE_PREP_METHOD_IDENTIFIER) as SAMPLE_PREP_METHOD_IDENTIFIER
, NVL(A.METHODIDENTIFIERCONTEXT2, X.SAMPLE_PREP_METHOD_CONTEXT) as SAMPLE_PREP_METHOD_CONTEXT
, X.SAMPLE_PREP_QUALIFIER_TYPE as SAMPLE_PREP_QUALIFIER_TYPE
, NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_PREP_DESC) as SAMPLE_PREP_DESC
, NVL(A.SampleContainerTypeName, X.SAMPLE_CONTAINER_TYPE) as SAMPLE_CONTAINER_TYPE
, NVL(A.SampleContainerColorName, X.SAMPLE_CONTAINER_COLOR) as SAMPLE_CONTAINER_COLOR
, NVL(A.ChemicalPreservativeUsedName, X.CHEM_PRESERVATIVE_USED) as CHEM_PRESERVATIVE_USED
, NVL(A.ThermalPreservativeUsedName, X.THERMAL_PRESERVATIVE_USED) as THERMAL_PRESERVATIVE_USED
, NVL(A.SAMPLETRANSPORTSTORAGEDESC, X.SAMPLE_TRANS_STORAGE) as SAMPLE_TRANS_STORAGE
, NVL(A.AnalysisStartTime, '') as AnalysisStartTime
, NVL(A.AnalysisEndTime, '') as AnalysisEndTime
, NVL(A.MethodSpeciationName, '') as MethodSpeciationName
, NVL(A.ResultLaboratoryCommentCode, '') as ResultLaboratoryCommentCode
, NVL(A.UnidentifiedSpeciesIdentifier, '') as UnidentifiedSpeciesIdentifier
FROM TMP_CHEMACTIVITYRESULTS A
JOIN WQX_ACTIVITY X ON A.ACTIVITYIDENTIFIER2 = X.ACTIVITY_IDENTIFIER
WHERE A.SUBMISSION_ID = 111242; -
Generate XML using DOM ( DocumentObjectBuilder )
Have a task to generate XMl from POJO objects
XML to be generated is complex
<element1>
<ElementChild>
<ChildElement1>
<ChildElement>
</ChildElement>
</ChildElement1>
<ChildElement2>
<ChildElement>
</ChildElement>
</ChildElement2>
<ChildElement3>
<ChildElement>
</ChildElement>
</ChildElement3>
<ChildElement4>
<ChildElement>
</ChildElement>
</ChildElement4>
</ElementChild>
</element1>
not able to do because the complex queries and requirement to populate
The same has been done with the help of appending nodes to document and appending childs but it has to be automated with the help of writing loops
any help appreciated
Thanks and Regards!!!
Ninjajay9982Can u send me the code. You might have missed out something on reading that XML .
-
How to generate xml using "Data Template"
Hi,
Can any one please tell me the steps to create xml using "Data Template".
As per the user guide the execution method for "data Template" is "Java Concurrent Program" and the Executable mentiones is "XDODTEXE".
But there is no information about the "execution file name" and "execution path name" which is mandatory.
Thanks and Regards,
SandhyaHi Sandhya,
To put a Data Template into use, you don't need to define any new executables. XDODTEXE executable is already registered in the system, as it ships with the application. The Data Template is not an executable as such, but a collection of instructions for what queries to perform and what should the resulting XML look like. XDODTEXE knows how to interpret those instructions, and produce the XML output.
(And if you add a layout template, handle that too.)
You do need to do the following:
1) Create a new Data Definition (XML Publisher Administrator > Data Definitions)
2) Upload your Data Template (remember the Code for the next step)
3) Create a Concurrent Program that is linked to the Data Definition (Short Name = Code) (System Administrator > Program > Define)
4) Add your Concurrent Program to a Request Group (System Administrator > Security > Responsibility > Request)
I recommend you take a look at the XML Publisher Administration and Developer's Guide, you will find more information there.
(http://download-west.oracle.com/docs/cd/B40089_02/current/acrobat/120xdoig.pdf)
Best Regards & Happy New Year 2008,
Matilda Smeds -
Generate XML using PHP for the gallery
Hi,
Thought I would contribute a demo for making the gallery XML
with PHP and
MySQL- all other seems to be in cold fusion.
<?php
header('Content-type: text/xml'); //Important
include('mysqli_connect.php'); //Connect to the database
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
echo "\n";
?>
<!-- The following can all be dynamically generated from
the database if you
want -->
<gallery
base = ""
background = "#FFFFFF"
banner = "#F0F0F0"
text = "#000000"
link = "#0000FF"
alink = "#FF0000"
vlink = "#800080"
date = "4/11/2006">
<sitename>Gallery</sitename>
<photographer></photographer>
<contactinfo></contactinfo>
<email></email>
<security><![CDATA[]]> </security>
<banner font = "Arial" fontsize = "3" color =
"#F0F0F0"> </banner>
<thumbnail base ="thumbnails/" font = "Arial" fontsize =
"4" color = "#F0F0F0"
border = "0" rows = "3" col = "5"> </thumbnail>
<large base ="images/" font = "Arial" fontsize = "3"
color = "#F0F0F0" border
= "0"> </large>
<photos id = "images">
/*Build the XML from the database - here I'm using two
tables, one contains
the info for the originals, the other for the thumbs.*/
<?php
$query = "SELECT orig.imageName AS oi, thumb.imageName AS ti
FROM
image_originals_gallery AS orig LEFT JOIN
image_thumbnails_gallery AS thumb
USING (imageId)";
$result = $db->query($query);
//Loop through the results:
while ($row = $result->fetch_assoc()) {
echo '<photo path = "' . $row['oi'] . '" width = "300"
height = "200"
thumbpath = "' . $row['ti'] . '" thumbwidth = "75"
thumbheight = "50"></photo>';
?>
</photos>
</gallery>
Thats it!
Hope that helps someone :)
Paul
http://www.pixellab.co.ukso what do u put here?
var dsTasks = new Spry.Data.XMLDataSet(" ??? ", "tasks/task")
is it 'yourthisCodepage.php'? -
Generating XML using PL/SQL
hi All,
We have an interface across two different applications in an organisation. Data is ported across these two application in a flat file which has specific format. These files are generated using generic pro c programs. Now we are planning to replace these files with XML. Also to replace generic pro c with PL/SQL to generate and read XML files. Now my question is, whether using PL/SQL to generate/read XML file will be faster than generating/reading flat files using pro c? Will the performance improve significantly? If anybody has worked on this, your inputs will be valuable.
Thanks in advance. Hoping to hear something veru soon from the masters.
Regards,
Rajeshhi All,
We have an interface across two different applications in an organisation. Data is ported across these two application in a flat file which has specific format. These files are generated using generic pro c programs. Now we are planning to replace these files with XML. Also to replace generic pro c with PL/SQL to generate and read XML files. Now my question is, whether using PL/SQL to generate/read XML file will be faster than generating/reading flat files using pro c? Will the performance improve significantly? If anybody has worked on this, your inputs will be valuable.
Thanks in advance. Hoping to hear something veru soon from the masters.
Regards,
Rajesh
Maybe you are looking for
-
Is Acrobat Reader 9.3.1 showing up for anyone yet
I am not seeing the 9.3.1 Acrobat Reader patch yet in my patch list. I am guessing it should be in the list by now. Anyone have it show up? If so I will need to dig around and see why I don't have it yet. Best Regards, Jim Koerner
-
Hi, can any one let me know in detail, the use of the fields <b>Block Key</b> & <b>Payment Method</b> in payment term configuration ? thank you. Hi experts, any answer ? Message was edited by: deb hari Message was edited by: deb hari
-
I have a km2m combo motherboard that supposedly supports a XP 2400 CPU. I'm trying o install, but it wont even power up, and when I try putting the old cpu back in it boots for about 15 seconds and then shuts off. Please Help
-
Activating an iTunes University Site
The activation link to set up my iTunes University account doesn't work any more. Does anyone know who I can contact to resolve this?
-
Pass values to Guid collection/array parameter for anonymous pl/sql block
The following code pops the System.ArgumentException: Invalid parameter binding Parameter name: p_userguids at Oracle.DataAccess.Client.OracleParameter.GetBindingSize_Raw(Int32 idx) at Oracle.DataAccess.Client.OracleParameter.PreBind_Raw() at Oracle.