Problem in xml query
Hi
I am working on BLS and having problem in xml query.I want to perform some calculation over xml columns.Than total of this as a new column.I can do this part in logic editor itself but can i do these both task by XSLT.
Can be made our own XSLT for this ?
I am feeling kind of fear to xslt. Can anybody help me in this.
Thanks a lot in advance
thomas
Ram,
In xMII there is a list of predefined xslt transforms that do something similar to what you are explaining. The 3 that I think may be what you are looking for are
they are under Calculation Transformations and Subtotal Transformation take a look at these and tell me if they are doing what you want to accomplish. In the xMII help file do a search on Inline Transforms or navigate to Advanced Topics -> Inline Transforms -> Predefined Inline Transforms. In this section there are examples of how to use these transforms and apply them in the query templates. If this is not what you are looking for can you explain in a little more detail along with a simple example of how you want this transform to work. Also why do you want to use xslt if you can already accomplish this in BLS?
Regards,
Erik
Similar Messages
-
Hi experts,
I am looking for help on the following XML query. I have a table (example) organized as such:
meas data_element
ABC rate
DEF rate1
DEF rate2
DEF rate3
GHI rate
JKL rate1a
JKL rate2b I'm trying to keep the "meas" column as the top node attribute, with the "data_elements" as attributes of the children of "meas"
In short, I'm looking for the following output, but, well..keep coming up short.
<meas id="ABC">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="DEF">
<data_elements>
<data_element id="rate1">
<rpt>false</rpt>
</data_element>
<data_element id="rate2">
<rpt>false</rpt>
</data_element>
<data_element id="rate3">
<rpt>false</rpt>
</data_element>
<data_elements>
</meas>
.....and so forth...I'm having trouble with getting the multiple rows of 'data_element' under 'data_elements', and under the single 'meas' one node, any suggestions? My code keeps generating multiple rows. The rpt node is a constant value of 'false'
ThanksYou have to group, and aggregate using XMLAgg :
SQL> set long 5000
SQL>
SQL> with sample_data (meas, data_element) as (
2 select 'ABC', 'rate' from dual union all
3 select 'DEF', 'rate1' from dual union all
4 select 'DEF', 'rate2' from dual union all
5 select 'DEF', 'rate3' from dual union all
6 select 'GHI', 'rate' from dual union all
7 select 'JKL', 'rate1a' from dual union all
8 select 'JKL', 'rate2b' from dual
9 )
10 select xmlserialize(content
11 xmlagg(
12 xmlelement("meas",
13 xmlattributes(meas as "id")
14 , xmlelement("data_elements",
15 xmlagg(
16 xmlelement("data_element",
17 xmlattributes(data_element as "id")
18 , xmlelement("rpt", 'false')
19 )
20 order by data_element -- if necessary
21 )
22 )
23 )
24 )
25 indent
26 ) as result
27 from sample_data
28 group by meas ;
RESULT
<meas id="ABC">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="DEF">
<data_elements>
<data_element id="rate1">
<rpt>false</rpt>
</data_element>
<data_element id="rate2">
<rpt>false</rpt>
</data_element>
<data_element id="rate3">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="GHI">
<data_elements>
<data_element id="rate">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas>
<meas id="JKL">
<data_elements>
<data_element id="rate1a">
<rpt>false</rpt>
</data_element>
<data_element id="rate2b">
<rpt>false</rpt>
</data_element>
</data_elements>
</meas> -
Problem with a query with a BLOB data type
Hi i've a problem with this query in 11g. R1
SELECT
LOGTIMESTAMP,
LOGTIMEMILLIS,
MSGID,
XMLTYPE(MESSAGEBODY, nls_charset_id('AL32UTF8')).getClobVal() as LLamada
FROM
vordel.AUDIT_MESSAGE_PAYLOAD,
vordel.AUDIT_LOG_POINTS
WHERE
AUDIT_LOG_POINTS.LOGPOINTSPK = AUDIT_MESSAGE_PAYLOAD.MP_LOGPOINTSPK AND
LOGTIMESTAMP between TO_TIMESTAMP('03-12-2011 00:00','DD-MM-YYYY HH24:MI') and TO_TIMESTAMP('03-12-2011 12:00','DD-MM-YYYY HH24:MI')
and filtertype = 'LogMessagePayloadFilter'
and filtername like 'Log Llamada%'MESSAGEBODY: data type of the Column is BLOB
throw this error after execute the query
Error:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00200: could not convert from encoding UTF-8 to UCS2
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 283
ORA-06512: at line 1Could you check the BLOB really contains UTF-8 encoded XML?
What's your database character set?The BLOB contains UTF-8 Encoded
and the database where i am connectes have AL32UTF8 character set, but my internal instance have "AMERICAN_AMERICA.WE8ISO8859P1"
that is a problem?
How could I change the character set of the oracle local client to the character set of the remote oracle data base? -
Problem for xml generation using DBMS_XMLGEN
Hi All,
i have problem during xml generation using Any help would be highly appreciate
how could we publish xml data using data base API DBMS_XMLGEN in oracle applications (APPS) i.e. at 'View Output" using
Any help would be highly appreciate.
Let me know if need more explanation, this is High priority for me.
Thanks and Regards,
[email protected]
Message was edited by:
user553699You can set the null attribute to true , so that the tag appears in your XML
see the statement in Bold.
DECLARE
queryCtx dbms_xmlquery.ctxType;
result CLOB;
BEGIN
-- set up the query context
queryCtx := dbms_xmlquery.newContext(
'SELECT empno "EMP_NO"
, ename "NAME"
, deptno "DEPT_NO"
, comm "COMM"
FROM scott.emp
WHERE deptno = :DEPTNO'
dbms_xmlquery.setRowTag(
queryCtx
, 'EMP'
dbms_xmlquery.setRowSetTag(
queryCtx
, 'EMPSET'
DBMS_XMLQUERY.useNullAttributeIndicator(queryCtx,true);
dbms_xmlquery.setBindValue(
queryCtx
, 'DEPTNO'
, 30
result := dbms_xmlquery.getXml(queryCtx);
insert into clobtable values(result);commit;
dbms_xmlquery.closeContext(queryCtx);
END;
select * from clobtable
<?xml version = '1.0'?>
<EMPSET>
<EMP num="1">
<EMP_NO>7499</EMP_NO>
<NAME>ALLEN</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM>300</COMM>
</EMP>
<EMP num="2">
<EMP_NO>7521</EMP_NO>
<NAME>WARD</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM>500</COMM>
</EMP>
<EMP num="3">
<EMP_NO>7654</EMP_NO>
<NAME>MARTIN</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM>1400</COMM>
</EMP>
<EMP num="4">
<EMP_NO>7698</EMP_NO>
<NAME>BLAKE</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM NULL="YES"/>
</EMP>
<EMP num="5">
<EMP_NO>7844</EMP_NO>
<NAME>TURNER</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM>0</COMM>
</EMP>
<EMP num="6">
<EMP_NO>7900</EMP_NO>
<NAME>JAMES</NAME>
<DEPT_NO>30</DEPT_NO>
<COMM NULL="YES"/>
</EMP>
</EMPSET>
http://sqltech.cl/doc/oracle9i/appdev.901/a89852/d_xmlque.htm -
Hi,
I have a problem with af:query. Here's what I do:
1. create a VO, define view criteria
2. drag and drop view criteria from data controls to an empty form, choosing query and table
3. When I run the page and click any of the buttons, I get: "Because of inactivity, your session has timed out and is no longer active...."
I see no exceptions in output window. What am I doing wrong?
Here is my view defenition:
<?xml version="1.0" encoding="windows-1250" ?>
<!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
<!---->
<ViewObject
xmlns="http://xmlns.oracle.com/bc4j"
Name="EmployeesView"
Version="11.1.1.49.49"
SelectList="Employees.EMPLOYEE_ID,
Employees.FIRST_NAME,
Employees.LAST_NAME,
Employees.EMAIL,
Employees.PHONE_NUMBER,
Employees.HIRE_DATE,
Employees.JOB_ID,
Employees.SALARY,
Employees.COMMISSION_PCT,
Employees.MANAGER_ID,
Employees.DEPARTMENT_ID"
FromList="EMPLOYEES Employees"
BindingStyle="OracleName"
CustomQuery="false"
PageIterMode="Full"
UseGlueCode="false">
<DesignTime>
<Attr Name="_codeGenFlag2" Value="Access|VarAccess"/>
</DesignTime>
<Variable
Name="firstName"
Kind="viewcriteria"
Type="java.lang.String"
DefaultValue="0"/>
<EntityUsage
Name="Employees"
Entity="project3.Employees"
JoinType="INNER JOIN"/>
<ViewAttribute
Name="EmployeeId"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="EmployeeId"
EntityUsage="Employees"
AliasName="EMPLOYEE_ID"/>
<ViewAttribute
Name="FirstName"
PrecisionRule="true"
EntityAttrName="FirstName"
EntityUsage="Employees"
AliasName="FIRST_NAME"/>
<ViewAttribute
Name="LastName"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="LastName"
EntityUsage="Employees"
AliasName="LAST_NAME"/>
<ViewAttribute
Name="Email"
IsUnique="true"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="Email"
EntityUsage="Employees"
AliasName="EMAIL"/>
<ViewAttribute
Name="PhoneNumber"
PrecisionRule="true"
EntityAttrName="PhoneNumber"
EntityUsage="Employees"
AliasName="PHONE_NUMBER"/>
<ViewAttribute
Name="HireDate"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="HireDate"
EntityUsage="Employees"
AliasName="HIRE_DATE"/>
<ViewAttribute
Name="JobId"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="JobId"
EntityUsage="Employees"
AliasName="JOB_ID"/>
<ViewAttribute
Name="Salary"
PrecisionRule="true"
EntityAttrName="Salary"
EntityUsage="Employees"
AliasName="SALARY"/>
<ViewAttribute
Name="CommissionPct"
PrecisionRule="true"
EntityAttrName="CommissionPct"
EntityUsage="Employees"
AliasName="COMMISSION_PCT"/>
<ViewAttribute
Name="ManagerId"
PrecisionRule="true"
EntityAttrName="ManagerId"
EntityUsage="Employees"
AliasName="MANAGER_ID"/>
<ViewAttribute
Name="DepartmentId"
PrecisionRule="true"
EntityAttrName="DepartmentId"
EntityUsage="Employees"
AliasName="DEPARTMENT_ID"/>
<ViewCriteria
Name="EmployeesViewCriteria"
ViewObjectName="project3.EmployeesView"
Conjunction="AND">
<Properties>
<CustomProperties>
<Property
Name="mode"
Value="Basic"/>
<Property
Name="allowConjunctionOverride"
Value="true"/>
<Property
Name="autoExecute"
Value="false"/>
<Property
Name="showInList"
Value="true"/>
<Property
Name="displayOperators"
Value="InAdvancedMode"/>
</CustomProperties>
</Properties>
<ViewCriteriaRow
Name="vcrow24"
UpperColumns="1">
<ViewCriteriaItem
Name="FirstName"
ViewAttribute="FirstName"
Operator="STARTSWITH"
Conjunction="AND"
UpperColumns="0"
Required="Optional">
<ViewCriteriaItemValue
Name="EmployeesViewCriteria_vcrow24_EmployeeId_vcval0"
Value=":firstName"
IsBindVarValue="true"/>
</ViewCriteriaItem>
</ViewCriteriaRow>
</ViewCriteria>
<ViewLinkAccessor
Name="EmployeesView"
ViewLink="project3.EmpManagerFkLink"
Type="oracle.jbo.RowIterator"
IsUpdateable="false"/>
</ViewObject>
And JSF page:
<af:panelGroupLayout layout="vertical">
<af:panelHeader text="Employees">
<af:query id="employeesViewCriteriaQueryId" headerText="Search"
disclosed="true"
resultComponentId="employeesViewCriteriaQueryResultId"
value="#{bindings.EmployeesViewCriteriaQuery.queryDescriptor}"
model="#{bindings.EmployeesViewCriteriaQuery.queryModel}"
queryListener="#{bindings.EmployeesViewCriteriaQuery.processQuery}"
queryOperationListener="#{bindings.EmployeesViewCriteriaQuery.processQueryOperation}"/>
</af:panelHeader>
<af:table value="#{bindings.EmployeesView1.collectionModel}" var="row"
rows="#{bindings.EmployeesView1.rangeSize}"
emptyText="#{bindings.EmployeesView1.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.EmployeesView1.rangeSize}"
id="employeesViewCriteriaQueryResultId">
<af:column sortProperty="EmployeeId" sortable="false"
headerText="#{bindings.EmployeesView1.hints.EmployeeId.label}">
<af:outputText value="#{row.EmployeeId}">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.EmployeesView1.hints.EmployeeId.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="FirstName" sortable="false"
headerText="#{bindings.EmployeesView1.hints.FirstName.label}">
<af:outputText value="#{row.FirstName}"/>
</af:column>
<af:column sortProperty="LastName" sortable="false"
headerText="#{bindings.EmployeesView1.hints.LastName.label}">
<af:outputText value="#{row.LastName}"/>
</af:column>
</af:table>
</af:panelGroupLayout>
Regards
Jernej
Message was edited by:
Jernej KaseIt also seems that quick queries don't work with SQL92 sqlBuilder.
I get the following error:
Messages for this page are listed below.
Error
SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE (( ( ( UPPER(Employees.FIRST_NAME) LIKE UPPER(:vc_temp_1) ) OR ( ? IS NULL ) ) ) )
Error
Missing IN or OUT parameter at index:: 2
Is this a bug or this doesn't work by design?
Edit: and if I create named query I get the following error:
Caused by: oracle.jbo.NoDefException: JBO-25058: Definition fn of type Attribute not found in EmployeesView1
at oracle.jbo.server.ViewObjectImpl.findAttributeDef(ViewObjectImpl.java:5634)
at oracle.jbo.uicli.binding.JUSearchBindingCustomizer.getQuickSearchVC(JUSearchBindingCustomizer.java:847)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:222)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
... 47 more
I think just ran out of options...
Message was edited by:
Jernej Kase -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
Hi
DECLARE @XMLA nvarchar(3000)
, @DateSerial nvarchar(35);
-- Change date to format YYYYMMDDHHMMSS
SET @DateSerial = CAST(GETDATE() AS DATE);
--SELECT @DateSerial
Set @XMLA =
N' <Batch xmlns="http://schemas.microsoft.com/analysis services/2003/engine">
<ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200"
xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<KeyErrorLimit>-1</KeyErrorLimit>
<KeyNotFound>IgnoreError</KeyNotFound>
<NullKeyNotAllowed>IgnoreError</NullKeyNotAllowed>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
<Object>
<DatabaseID>MultidimensionalProject5</DatabaseID>
<CubeID>giri</CubeID>
<MeasureGroupID>Fact Internet Sales</MeasureGroupID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>';
EXEC (@XMLA) At SHALL-PCAdventureWorksDw ;
iam executive the query when iam getting below error.
[Execute SQL Task] Error: Executing the query "DECLARE
@XMLA nvarchar(3000)
, @DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly.
how to solve this error;
please help meWhat are you trying to do? What sort of data source is SHALL-PCAdventureWorksDw?
When you use EXEC() AT, I would execpt to see an SQL string to be passed to EXEC(), but you are passing an XML string????
If you explain why you think this would work in the first place, maybe we can help you.
Erland Sommarskog, SQL Server MVP, [email protected] -
Xcelsius with XMLA or XML Query Result Set
Hi Experts,
I want a direct connection from Xcelsius to my BW-Data. Because the new connection, coming with Fix Pack 2.1 is only avaiable for EHP 1 for NW 7.0 I tried to configure with XMLA and XML Query Result Set.
This Document tells the necessary steps: How to integrate Xcelsius 2008 with SAP NetWeaver BI without Integration Kit.pdf.
When I test my XML connection over http://<host>:<port>/TXmla/srvlet/TestXmla my Cubes will display.
So I do a Webservice-Connection with WSDL-URL. At Input-Values there are some entries like CUBE_NAME, CATALOG_NAME...
Output values arent avalible. How do I use these elements to show my Data in Xcelsius?
My Problem with the XML Query Result Set Connection is, that when I Log On to VC the following error appears:
You are not authorized to view the requested resource.
So I get the authorisationobjects: S_DEVELOP and S_RS_COMP as describe in 'How To... Resolve Visual Composer Issues'.
What values have I to enter by S_RS_COMP? And how can I enter my External Service in S_SERVICE. At the type WS the service isnt't avaiable.
Regards,
JanTo use XMLA web service you need a wrapper function build to convert the XMLA output to the Xcelsius format. There are some documents available in SDN on how to do this.
You can use Live Office or Query as a Web service option to connect from Xcelsius to BW.
S_RS_COMP is the query ID which you are trying to access, S_SERVICE you can either give * or try to set up authorization log and see the expected value. -
No method found for XML query element
Hi,
I have an EJB module which contains some entity beans.
If I try to deploy it or verify it using the Sun One Verifier Tool I get the following exception...
Error: ** Error trying to process file: java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
java.lang.RuntimeException: No method found for XML query element: Ambiguous or invalid <query-method>
at com.sun.enterprise.deployment.xml.EjbNode.parseQueries(EjbNode.java:700)
at com.sun.enterprise.deployment.xml.EjbNode.completeLoadingDescriptor(EjbNode.java:671)
at com.sun.enterprise.deployment.xml.EjbBundleNode.completeLoadingDescriptor(EjbBundleNode.java:524)
at com.iplanet.ias.deployment.EjbBundleXmlReader.load(EjbBundleXmlReader.java:249)
at com.iplanet.ias.deployment.EjbBundleXmlReader.loadStdAloneModule(EjbBundleXmlReader.java:162)
at com.sun.enterprise.tools.verifier.Verifier.openEjbJar(Verifier.java:2421)
at com.sun.enterprise.tools.verifier.Verifier.loadEjbJar(Verifier.java:1318)
at com.sun.enterprise.tools.verifier.Verifier.loadJar(Verifier.java:866)
at com.sun.enterprise.tools.verifier.gui.MainPanel.run(MainPanel.java:187)
at java.lang.Thread.run(Thread.java:536)
Look in file "EntityBeans.jar_verified.xml" for detailed results on test assertions.
This problem can be resolved by un-installing the IDE, removing my user directory, and re-installing the IDE (I am using SunOne Studio 5 SE Update 1). The problem is that it returns with alarming regularity.
Anyone else experiencing this? Any help would be much appreciated.Sometimes, but not always, this exception appears in the ide.log before the error first occurs.
com.sun.forte4j.j2ee.packaging.PackagingIOException: package/EntityBeans.ejbjar
at com.sun.forte4j.j2ee.packaging.PackagingUtil.writeJarFile(PackagingUtil.java:403)
at com.sun.forte4j.j2ee.packaging.PackagingUtil.writeJarFile(PackagingUtil.java:67)
at com.sun.forte4j.j2ee.ejbmodule.EJBModuleDataObject.writeEJBJar(EJBModuleDataObject.java:2673)
at com.iplanet.ias.tools.forte.verifier.VerifierAction.performAction(VerifierAction.java:63)
at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:431)
at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:97)
at org.openide.util.Task.run(Task.java:136)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670) -
Use of Global Properties in URL path of XML Query
I am trying to use global properties to define the URL of XML query:
Globals.ImageFilePath&"SomePath/\File.xml"
but it does not like it. If I put the content of the Globals.ImageFilePath it works fine. What is the synatax for that?
I am using the XML query in a transaction within an image creation action block. When I try to define the URL parameter of the XML file as a link, it is not taken on account, and the image created has no data (it is empty). The URL is taken when defined on the Cofigure Object screen, but there I have the same problem to use the global variable parameter.
Any suggestions?
Thanks,
Vlad
Edited by: Vladimir Baltchev on Jul 29, 2008 11:33 PM
Edited by: Vladimir Baltchev on Jul 29, 2008 11:40 PMAs I mentioned in my first posting, yes, I can put the global variable of the link editor for the URL parameter, it evaluates well, but it is not taken on account by the query, and the image generated is empty. Obviously there is a bug here, so I am trying to find a work around to use the global variable on the Configure Object screen, where the parameter URL is taken by the XML query, but on this screen I can not use the global variable. It works only if I put the content of the global variable.
So, does anybody know if we can use global variables on a Configure Object screen, or on the XML query URL field, and if so, what is the syntax to indicate global variable?
Thanks again,
Vlad -
Cooresponding Lists Names/Values XML Query
Let's say there is an XML Schema that has
<element name="mt" minOccurs="0" maxOccurs="unbounded">
<element name="r" minOccurs="0" maxOccurs="unbounded">
And for each measurement type (mt), you have a cooresponding measurement value (r). There are additional elements between these two lists. The actual XML data would look similiar to
<mi>
<mts>20061117100000-0800</mts>
<gp>900</gp>
<mt>MeasurementType1</mt>
<mt>MeasurementType2</mt>
<mt>MeasurementType3</mt>
<mt>MeasurementType4</mt>
<mt>MeasurementType5</mt>
<mt>MeasurementType6</mt>
<mt>MeasurementType7</mt>
<mv>
<moid>Identifier</moid>
<r>58</r>
<r>62</r>
<r>43</r>
<r>45</r>
<r>43</r>
<r>14</r>
<r>29</r>
<sf>FALSE</sf>
</mv>
</mi>
The first occurance of mt corresponds to the first occurance of r, the second cooresponds to the second, et cetra.
The MI element can repeat hundreds of times and there can be many measurementTypes. Now, I'm trying to figure out how I can create an XML query to efficiently handle this. The problem is that the <r> value is within the complexType <mv> and that is on the same level as <mt>. The XML Query would cause a cartesian product if I were to use something like ...
select
extractValue(value(xmldata), '/mi/mts') measurement_time_stamp,
extractValue(value(xmldata), '/mi/gp') granularity_period,
extractValue(value(mt), '/mt') measurement_type,
extractValue(value(mv), '/mv/moid') measured_obj_id,
extractValue(value(r), '/r') measurement_value,
from xmltable
, TABLE(XMLSequence(Extract(value(xmltable), '/mi/mv'))) mv
, TABLE(XMLSequence(Extract(value(mi), '/mi/mt'))) mt
, TABLE(XMLSequence(Extract(value(mi), '/mv/r'))) r
This obviously wouldn't work. I could go and store all the types and values into a column using
select
replace(replace(replace(extract(value(mi), '/mi/mt').getStringVal(), '</mt><mt>', ';'), '<mt>'), '</mt>') measurement_type,
extractValue(value(mv), '/mv/moid') measured_obj_id,
replace(replace(replace(extract(value(mv), '/mv/r').getStringVal(), '</r><r>', ';'), '<r>'), '</r>') measurement_value
from xmltable
TABLE(XMLSequence(Extract(value(xmldata), '/md/mi'))) mi
, TABLE(XMLSequence(Extract(value(mi), '/mi/mv'))) mv
But this wouldn't work once the XML grew over 4000 bytes. So I need a way to extract this data maintaining the correct integrity (avoiding cartesians).
One idea is a pipelined table function but I have concerns about scalability with that method. Is there a way to accomplish this optimally? I have solutions for this but none of them is going to deliver the scalability I am seeking.
I expect the method chosen will probably need to handle a few hundred thousand files per day.
Thanks,VJ
I'd not seen your XML schema when I worked the original example, so I reverse engineered it from the instance. Unfortunately when I work with your schema, which contains more levels of nested I can't get it to optimize properly
Here's what should work in theory
SQL> set echo on
SQL> spool testcase.log
SQL> --
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> --
SQL> define USERNAME = OTNTEST
SQL> --
SQL> def PASSWORD = OTNTEST
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> def LOCAL_FILESYSTEM = 'C:\xdb\otn\457595'
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user OTNTEST cascade
User dropped.
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to OTNTEST identified by OTNTEST
Grant succeeded.
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to OTNTEST
Grant succeeded.
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to OTNTEST
Grant succeeded.
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user OTNTEST default tablespace USERS temporary tablespace TEMP
User altered.
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> create or replace directory XMLDIR as '&LOCAL_FILESYSTEM'
2 /
old 1: create or replace directory XMLDIR as '&LOCAL_FILESYSTEM'
new 1: create or replace directory XMLDIR as 'C:\xdb\otn\457595'
Directory created.
SQL> begin
2 :schemaURL := 'testcase.xsd';
3 :schemaPath := '/public/testcase.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL>
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
5 <!--W3C Schema generated by XMLSpy v2007 (http://www.altova.com)-->
6 <!--Please add namespace attributes, a targetNamespace attribute and import elements according to your requirements-->
7 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" attributeFormDefaul
t="unqualified" xdb:storeVarrayAsTable="true">
8 <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
9 <xs:element name="mdc" xdb:defaultTable="MDC_TABLE">
10 <xs:complexType xdb:SQLType="MDC_TYPE" xdb:maintainDOM="false">
11 <xs:sequence>
12 <xs:element ref="mfh"/>
13 <xs:element ref="md" minOccurs="0" maxOccurs="unbounded"/>
14 <xs:element ref="mff"/>
15 </xs:sequence>
16 </xs:complexType>
17 </xs:element>
18 <xs:element name="mfh" xdb:defaultTable="">
19 <xs:complexType xdb:SQLType="MFH_TYPE" xdb:maintainDOM="false">
20 <xs:sequence>
21 <xs:element ref="ffv"/>
22 <xs:element ref="sn"/>
23 <xs:element ref="st"/>
24 <xs:element ref="vn"/>
25 <xs:element ref="cbt"/>
26 </xs:sequence>
27 </xs:complexType>
28 </xs:element>
29 <xs:element name="md" xdb:defaultTable="" >
30 <xs:complexType xdb:SQLType="MD_TYPE" xdb:maintainDOM="false">
31 <xs:sequence>
32 <xs:element ref="neid"/>
33 <xs:element ref="mi" minOccurs="0" maxOccurs="unbounded" />
34 </xs:sequence>
35 </xs:complexType>
36 </xs:element>
37 <xs:element name="neid" xdb:defaultTable="" >
38 <xs:complexType xdb:SQLType="NEID_TYPE" xdb:maintainDOM="false">
39 <xs:sequence>
40 <xs:element ref="neun"/>
41 <xs:element ref="nedn"/>
42 </xs:sequence>
43 </xs:complexType>
44 </xs:element>
45 <xs:element name="mi" xdb:defaultTable="" >
46 <xs:complexType xdb:SQLType="MI_TYPE" xdb:maintainDOM="false">
47 <xs:sequence>
48 <xs:element ref="mts"/>
49 <xs:element ref="gp"/>
50 <xs:element ref="mt" minOccurs="0" maxOccurs="unbounded"/>
51 <xs:element ref="mv" minOccurs="0" maxOccurs="unbounded" />
52 </xs:sequence>
53 </xs:complexType>
54 </xs:element>
55 <xs:element name="mv" xdb:defaultTable="" >
56 <xs:complexType xdb:SQLType="MV_TYPE" xdb:maintainDOM="false">
57 <xs:sequence>
58 <xs:element ref="moid"/>
59 <xs:element ref="r" minOccurs="0" maxOccurs="unbounded"/>
60 <xs:element ref="sf" minOccurs="0"/>
61 </xs:sequence>
62 </xs:complexType>
63 </xs:element>
64 <xs:element name="mff" xdb:defaultTable="" >
65 <xs:complexType xdb:maintainDOM="false">
66 <xs:sequence>
67 <xs:element ref="ts"/>
68 </xs:sequence>
69 </xs:complexType>
70 </xs:element>
71 <xs:element name="ts" type="xs:string"/>
72 <xs:element name="sf" type="xs:string"/>
73 <xs:element name="r">
74 <xs:complexType xdb:SQLType="R_TYTPE" xdb:maintainDOM="false">
75 <xs:simpleContent>
76 <xs:extension base="xs:string">
77 <xs:attribute ref="dummy" use="prohibited"/>
78 </xs:extension>
79 </xs:simpleContent>
80 </xs:complexType>
81 </xs:element>
82 <xs:attribute name="dummy" type="xs:boolean"/>
83 <xs:element name="mt">
84 <xs:complexType xdb:SQLType="MT_TYTPE" xdb:maintainDOM="false">
85 <xs:simpleContent>
86 <xs:extension base="xs:string">
87 <xs:attribute ref="dummy" use="prohibited"/>
88 </xs:extension>
89 </xs:simpleContent>
90 </xs:complexType>
91 </xs:element>
92 <xs:element name="moid" type="xs:string"/>
93 <xs:element name="gp" type="xs:string"/>
94 <xs:element name="mts" type="xs:string"/>
95 <xs:element name="nedn" type="xs:string"/>
96 <xs:element name="neun" type="xs:string"/>
97 <xs:element name="cbt" type="xs:string"/>
98 <xs:element name="vn" type="xs:string"/>
99 <xs:element name="st" type="xs:string"/>
100 <xs:element name="sn" type="xs:string"/>
101 <xs:element name="ffv" type="xs:string"/>
102 </xs:schema>');
103 begin
104 if (dbms_xdb.existsResource(:schemaPath)) then
105 dbms_xdb.deleteResource(:schemaPath);
106 end if;
107 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
108 end;
109 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 :schemaURL,
5 xdbURIType(:schemaPath).getClob(),
6 TRUE,TRUE,FALSE,TRUE
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> declare
2 nested_table_name varchar2(256);
3 iot_index_name varchar2(256);
4 begin
5 select table_name
6 into nested_table_name
7 from user_nested_tables
8 where parent_table_column = '"XMLDATA"."md"'
9 and parent_table_name = 'MDC_TABLE';
10
11 execute immediate 'rename "'|| nested_table_name ||'" to MD_TABLE';
12
13 select index_name
14 into iot_index_name
15 from user_indexes
16 where table_name = 'MD_TABLE' and index_type = 'IOT - TOP';
17
18 execute immediate 'alter index "'|| iot_index_name ||'" rename to MD_IOT';
19
20 select table_name
21 into nested_table_name
22 from user_nested_tables
23 where parent_table_column = 'mi'
24 and parent_table_name = 'MD_TABLE';
25
26 execute immediate 'rename "'|| nested_table_name ||'" to MI_TABLE';
27
28 select index_name
29 into iot_index_name
30 from user_indexes
31 where table_name = 'MI_TABLE' and index_type = 'IOT - TOP';
32
33 execute immediate 'alter index "'|| iot_index_name ||'" rename to MI_IOT';
34
35 select table_name
36 into nested_table_name
37 from user_nested_tables
38 where parent_table_column = 'mt'
39 and parent_table_name = 'MI_TABLE';
40
41 execute immediate 'rename "'|| nested_table_name ||'" to MT_TABLE';
42
43 select index_name
44 into iot_index_name
45 from user_indexes
46 where table_name = 'MT_TABLE' and index_type = 'IOT - TOP';
47
48 execute immediate 'alter index "'|| iot_index_name ||'" rename to MT_IOT';
49
50 select table_name
51 into nested_table_name
52 from user_nested_tables
53 where parent_table_column = 'mv'
54 and parent_table_name = 'MI_TABLE';
55
56 execute immediate 'rename "'|| nested_table_name ||'" to MV_TABLE';
57
58 select index_name
59 into iot_index_name
60 from user_indexes
61 where table_name = 'MV_TABLE' and index_type = 'IOT - TOP';
62
63 execute immediate 'alter index "'|| iot_index_name ||'" rename to MV_IOT';
64
65 select table_name
66 into nested_table_name
67 from user_nested_tables
68 where parent_table_column = 'r'
69 and parent_table_name = 'MV_TABLE';
70
71 execute immediate 'rename "'|| nested_table_name ||'" to R_TABLE';
72
73 select index_name
74 into iot_index_name
75 from user_indexes
76 where table_name = 'R_TABLE' and index_type = 'IOT - TOP';
77
78 execute immediate 'alter index "'|| iot_index_name ||'" rename to R_IOT';
79 end;
80 /
PL/SQL procedure successfully completed.
SQL> desc MDC_TABLE
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "testcase.xsd" Element "mdc") STORAGE Object-relational TYPE "MDC_TYPE"
SQL> --
SQL> desc MD_TABLE
Name Null? Type
neid NEID_TYPE
mi mi9495_COLL
SQL> --
SQL> desc MI_TABLE
Name Null? Type
mts VARCHAR2(4000 CHAR)
gp VARCHAR2(4000 CHAR)
mt mt9493_COLL
mv mv9494_COLL
SQL> --
SQL> desc MT_TABLE
Name Null? Type
SYS_XDBBODY$ VARCHAR2(4000 CHAR)
dummy RAW(1)
SQL> --
SQL> desc MV_TABLE
Name Null? Type
moid VARCHAR2(4000 CHAR)
r r9492_COLL
sf VARCHAR2(4000 CHAR)
SQL> --
SQL> desc R_TABLE
Name Null? Type
SYS_XDBBODY$ VARCHAR2(4000 CHAR)
dummy RAW(1)
SQL> --
SQL> set autotrace on explain
SQL> set lines 150 pages 100
SQL> --
SQL> var XMLTEXT varchar2(4000)
SQL> --
SQL> begin
2 :xmlText :=
3 '<mdc>
4 <mfh>
5 <ffv/>
6 <sn/>
7 <st/>
8 <vn/>
9 <cbt/>
10 </mfh>
11 <md>
12 <neid>
13 <neun/>
14 <nedn/>
15 </neid>
16 <mi>
17 <mts>20061117100000-0800</mts>
18 <gp>900</gp>
19 <mt>MeasurementType1</mt>
20 <mt>MeasurementType2</mt>
21 <mt>MeasurementType3</mt>
22 <mt>MeasurementType4</mt>
23 <mt>MeasurementType5</mt>
24 <mt>MeasurementType6</mt>
25 <mt>MeasurementType7</mt>
26 <mv>
27 <moid>Identifier</moid>
28 <r>58</r>
29 <r>62</r>
30 <r>43</r>
31 <r>45</r>
32 <r>43</r>
33 <r>14</r>
34 <r>29</r>
35 <sf>FALSE</sf>
36 </mv>
37 </mi>
38 </md>
39 <mff>
40 <ts/>
41 </mff>
42 </mdc>';
43 end;
44 /
PL/SQL procedure successfully completed.
SQL> insert into MDC_TABLE values ( xmltype ( :xmltext ))
2 /
1 row created.
Execution Plan
Plan hash value: 1621636734
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | INSERT STATEMENT | | 1 | 100 | 1 (0)| 00:00:01 |
| 1 | LOAD TABLE CONVENTIONAL | MDC_TABLE | | | | |
SQL> commit
2 /
Commit complete.
SQL> select MT_INDEX, MT_VALUE, R_VALUE
2 from MDC_TABLE,
3 xmlTable
4 (
5 '/mdc/md/mi'
6 passing object_value
7 columns
8 XML xmltype path '.'
9 ) MI,
10 xmlTable
11 (
12 '/mi/mt'
13 passing MI.XML
14 columns
15 MT_INDEX for ordinality,
16 MT_VALUE varchar2(32) path 'text()'
17 ) MT,
18 xmlTable
19 (
20 '/mi/mv/r'
21 passing MI.XML
22 columns
23 R_INDEX for ordinality,
24 R_VALUE varchar2(32) path 'text()'
25 ) R
26 where MT_INDEX = R_INDEX
27 /
MT_INDEX MT_VALUE R_VALUE
1 MeasurementType1 58
2 MeasurementType2 62
3 MeasurementType3 43
4 MeasurementType4 45
5 MeasurementType5 43
6 MeasurementType6 14
7 MeasurementType7 29
7 rows selected.
Execution Plan
Plan hash value: 2832518671
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5449M| 19T| 1616M (1)|999:59:59 |
| 1 | NESTED LOOPS | | 5449M| 19T| 1616M (1)|999:59:59 |
| 2 | NESTED LOOPS | | 66M| 237G| 197K (1)| 00:39:36 |
| 3 | NESTED LOOPS | | 8168 | 29M| 27 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | MDC_TABLE | 1 | 3788 | 3 (0)| 00:00:01 |
| 5 | COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE | | | | |
| 6 | VIEW | | 8168 | 247K| 24 (0)| 00:00:01 |
| 7 | COUNT | | | | | |
| 8 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
|* 9 | VIEW | | 82 | 2542 | 24 (0)| 00:00:01 |
| 10 | COUNT | | | | | |
| 11 | COLLECTION ITERATOR PICKLER FETCH | XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd http://xmlns.oracle.com/xdb/acl.xsd
DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-properties/><read-contents/></privilege>'))=1)
9 - filter("MT_INDEX"="R_INDEX")
Note
- dynamic sampling used for this statement
SQL>As you can see the re-write is not working out in this case. I'll ask development to take a look at it and see if they can solve it. I think it's similar to another bug I've filed...
WRT to your question about transforming. One easy transformation would be to number the nodes.. Eg use XSTL to add an index number to each MT node and each R node and then join on that value. -
Problem in Adhoc Query's set operation functionality.
Hi Experts,
I am facing problem executing Adhoc Query's set operation functionality.
In Selection Tab, following operations are performed :-
Execute a query and mark it as 'Set A'.(Say Hit list = X)
Execute another query and mark it as 'Set B'.(Say Hit list = Y)
In Set operation Tab, following operations are performed :-:-
Carry out an Operations 'Set A minus Set B'.
which results in Resulting Set = Z.
Transfer the resulting set 'in hit list' and press the copy resulting set button.
In Selection Tab, Hit list is populated with Z.
And when output button is pressed, I get to see 'Y' list and not 'Z' list.
Kindly help.
Thanks.
YogeshHi Experts,
I am facing problem executing Adhoc Query's set operation functionality.
In Selection Tab, following operations are performed :-
Execute a query and mark it as 'Set A'.(Say Hit list = X)
Execute another query and mark it as 'Set B'.(Say Hit list = Y)
In Set operation Tab, following operations are performed :-:-
Carry out an Operations 'Set A minus Set B'.
which results in Resulting Set = Z.
Transfer the resulting set 'in hit list' and press the copy resulting set button.
In Selection Tab, Hit list is populated with Z.
And when output button is pressed, I get to see 'Y' list and not 'Z' list.
Kindly help.
Thanks.
Yogesh -
hi everybody,
I've a big problem with XML on Linux, in details I see my program stopping on Linux at the instruction
XMLReader xr = XMLReaderFactory.createXMLReader("org.apache.crimson.parser.XMLReaderImpl");
and it's strange because on Windows it runs and there aren't problems about permissions on files, does anyone knows what to do?
thanks in advance!
StefanoWhat happens on that line? I'm assuming you get some kind of error or exception.
Make sure the JAR file for Crimson is in your classpath. -
Problem with XML in APEX ORA-06502
i, I have a problem with XML generation, I developed an application in APEX, and in a html page I have this process:
declare
l_XML varchar2(32767);
begin
select xmlElement
"iva",
xmlElement("numeroRuc",J.RUC),
xmlElement("razonSocial", J.RAZON_SOCIAL),
xmlElement("idRepre", J.ID_REPRE),
xmlElement("rucContador", J.RUC_CONTADOR),
xmlElement("anio", J.ANIO),
xmlElement("mes", J.MES),
xmlElement
"compras",
select xmlAgg
xmlElement
"detalleCompra",
--xmlAttributes(K.ID_COMPRA as "COMPRA"),
xmlForest
K.COD_SUSTENTO as "codSustento",
K.TPLD_PROV as "tpldProv",
K.ID_PROV as "idProv",
K.TIPO_COMPROBANTE as "tipoComprobante",
to_char(K.FECHA_REGISTRO, 'DD/MM/YYYY') as "fechaRegistro",
K.ESTABLECIMIENTO as "establecimiento",
K.PUNTO_EMISION as "puntoEmision",
K.SECUENCIAL as "secuencial",
to_char(K.FECHA_EMISION, 'DD/MM/YYYY') as "fechaEmision",
K.AUTORIZACION as "autorizacion",
to_char(K.BASE_NO_GRA_IVA, 9999999999.99) as "baseNoGraIva",
to_char(K.BASE_IMPONIBLE, 9999999999.99) as "baseImponible",
to_char(K.BASE_IMP_GRAV, 9999999999.99) as "baseImpGrav",
to_char(K.MONTO_ICE, 9999999999.99) as "montoIce",
to_char(K.MONTO_IVA, 9999999999.99) as "montoIva",
to_char(K.VALOR_RET_BIENES, 9999999999.99) as "valorRetBienes",
to_char(K.VALOR_RET_SERVICIOS, 9999999999.99) as "valorRetServicios",
to_char(K.VALOR_RET_SERV_100, 9999999999.99) as "valorRetServ100"
xmlElement
"air",
select xmlAgg
xmlElement
"detalleAir",
xmlForest
P.COD_RET_AIR as "codRetAir",
to_char(P.BASE_IMP_AIR, 9999999999.99) as "baseImpAir",
to_char(P.PORCENTAJE_AIR, 999.99) as "porcentajeAir",
to_char(P.VAL_RET_AIR, 9999999999.99) as "valRetAir"
from ANEXO_COMPRAS P
where P.ID_COMPRA = K.ID_COMPRA
AND P.ID_INFORMANTE_XML = K.ID_INFORMANTE_XML
xmlElement("estabRetencion1", K.ESTAB_RETENCION_1),
xmlElement("ptoEmiRetencion1", K.PTO_EMI_RETENCION_1),
xmlElement("secRetencion1", K.SEC_RETENCION_1),
xmlElement("autRetencion1", K.AUT_RETENCION_1),
xmlElement("fechaEmiRet1", to_char(K.FECHA_EMI_RET_1,'DD/MM/YYYY')),
xmlElement("docModificado", K.DOC_MODIFICADO),
xmlElement("estabModificado", K.ESTAB_MODIFICADO),
xmlElement("ptoEmiModificado", K.PTO_EMI_MODIFICADO),
xmlElement("secModificado", K.SEC_MODIFICADO),
xmlElement("autModificado", K.AUT_MODIFICADO)
from SRI_COMPRAS K
WHERE K.ID IS NOT NULL
AND K.ID_INFORMANTE_XML = J.ID_INFORMANTE
AND K.ID BETWEEN 1 AND 25
).getClobVal()
into l_XML
from ANEXO_INFORMANTE J
where J.ID_INFORMANTE =:P3_MES
and J.RUC =:P3_ID_RUC
and J.ANIO =:P3_ANIO
and J.MES =:P3_MES;
--HTML
sys.owa_util.mime_header('text/xml',FALSE);
sys.htp.p('Content-Length: ' || length(l_XML));
sys.owa_util.http_header_close;
sys.htp.print(l_XML);
end;
Now my table has more than 900 rows and only when I specifically selected 25 rows of the table "ANEXO_COMPRAS" in the where ( AND K.ID BETWEEN 1 AND 25) the XML is generated.+
I think that the problem may be the data type declared "varchar2", but I was trying with the data type "CLOB" and the error is the same.+
declare
l_XML CLOB;
begin
--Oculta XML
sys.htp.init;
wwv_flow.g_page_text_generated := true;
wwv_flow.g_unrecoverable_error := true;
--select XML
select xmlElement
from SRI_COMPRAS K
WHERE K.ID IS NOT NULL
AND K.ID_INFORMANTE_XML = J.ID_INFORMANTE
).getClobVal()
into l_XML
from ANEXO_INFORMANTE J
where J.ID_INFORMANTE =:P3_MES
and J.RUC =:P3_ID_RUC
and J.ANIO =:P3_ANIO
and J.MES =:P3_MES;
--HTML
sys.owa_util.mime_header('text/xml',FALSE);
sys.htp.p('Content-Length: ' || length(l_XML));
sys.owa_util.http_header_close;
sys.htp.print(l_XML);
end;
The error generated is ORA-06502: PL/SQL: numeric or value error+_
Please I need your help. I don`t know how to resolve this problem, how to use the data type "CLOB" for the XML can be generate+JohannaCevallos07 wrote:
Now my table has more than 900 rows and only when I specifically selected 25 rows of the table "ANEXO_COMPRAS" in the where ( AND K.ID BETWEEN 1 AND 25) the XML is generated.+
I think that the problem may be the data type declared "varchar2", but I was trying with the data type "CLOB" and the error is the same.+
The error generated is ORA-06502: PL/SQL: numeric or value error+_
Please I need your help. I don`t know how to resolve this problem, how to use the data type "CLOB" for the XML can be generate+The likeliest explanation for this is that length of the XML exceeds 32K, which is the maximum size that <tt>htp.p</tt> can output. A CLOB can store much more than this, so it's necessary to buffer the output as shown in +{message:id=4497571}+
Help us to help you. When you have a problem include as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
And always post code wrapped in <tt>\...\</tt> tags, as described in the FAQ.
Thanks -
Dear All,
I am having some problem in SQL query. I am trying to get total sum of one inventory using the following query it works fine:
sum(case when mt.transaction_quantity > 0 then (mt.transaction_quantity) else 0 end) "TOT_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (abs(mt.transaction_quantity)) end) "TOT_OUT"
But when I breakup the total sum into monthly breakup it fails to return the correct some could any one help what is wrong in the following query which is returning incorrect monthly sum. Following is that query. Your help in this regard would highly be appreciated.
sum(case when mt.transaction_quantity > 0 then (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, mt.transaction_quantity, null)) else 0 end) "MONTH1_IN"
,sum(case when mt.transaction_quantity >= 0 then 0 else (decode (floor (floor (to_date('17-MAR-2009')- mt.transaction_date) / 30), 0, abs(mt.transaction_quantity), null)) end) "MONTH1_OUT"
ThanksHi,
Sorry, I don't really understand what you want.
Whenever you have a question, it helps to post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data
(4) Your best attempt so far (formatted)
(5) The full error message (if any), including line number
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
If you can present your problem using commonly available tables (for example, tables in scott schema, or views in the data dictionary), then you can omit (2).
Formatted tabular output is okay for (3). Type these 6 characters
{code}
(small letters only, inside curly brackets) before and after the tabular text, to preserve spacing.
What exactly do you mean by "monthly breakup"?
If you want separate figures for each calendar month, Blushadow's suggestion (TRUNC (mt.transaction_date, 'MM')) is what you want.
If you want separate figures for the last 30 days before today, then something like what you posted ("FLOOR ((:target_date - mt.transaction_date) / 30)": the extra FLOOR doesn't help any) should work, so if you ran the query on March 17, 2009, the first "month" would be February 16 through March 17.
In a CASE statement, there's rarely any need to use DECODE. The following is equivalent to the last line of code you posted:
, SUM ( CASE
WHEN mt.transaction_quantity >= 0
THEN 0
WHEN TO_DATE ('17-MAR-2009', 'DD-MON-YYYY') - mt.transaction_date
BETWEEN 0
AND 29.99999 -- 30 days minus a fraction of a second
THEN ABS (mt.transaction_quantity)
END
) AS month1_outDon't you find this easier to understand (and debug)?
Maybe you are looking for
-
Album order (after "sort photos manually") not staying
I have an album of about 500 pictures (from my 10,000 library). I sorted the pictures in it manually, but every time I close iPhoto and then reopen it, the order is messed up a bit with random pictures are out of order. any ideas? roger
-
Hi All, I was trying to execute a standard function module in which there is a sql statement where IN operator is used. The no of choices given for that field by the IN operator is 1065. The error displayed is the SQL statement generated from the SA
-
Solution to the "One Moment Please connecting to the iTunes store" Problem
Thought I would post this as a new topic because I see many people had the same problem as I do (did). I kept getting the "One Momement Please connecting to the iTunes store" problem and could not figure out what was going on. I basically turned off
-
Logic Studio Freezes at Startup
Logic freezes at startup splash window. Locks at "Searching for Audio Unit plug-ins (Apple: AUSpeechSynthesis)..." My setup: Logic Version 9.1.6 OSX version 10.7.3, imac 2.8 Ghz Intel Core i7, 8GB RAM Any Suggestions? Crash Report: Date/Time: 2012-
-
I love the old MS-DOS games, and I've just heard about DOSBox, a free DOS-emulator that can apparently run under OS X. Does anyone have any experience of running DOSBox with OS 10.4? (PowerMac G5). - Does it work well? Can old PC DOS games be install