UpdateXML query rewrite with unstructured data?
Hi,
I'm currently loading unstructured, non-schema based XML and am trying to address some performance issues when I merge changes to a document.
I currently read the document from the table, merge the changes using XQuery and save the document back - however, I'm aware that this can be excessive when a minor number of changes are involved (I'm also seeing some contention on the path table when a number of parallel threads are involved).
I know that using "updateXML" and "insertChildXML" can be more efficient due to the XPath rewrite - however, I'm not sure if this is applicable when the XML is unstructured and non-schema based.
Any advice on this would be greatly appreciated.
Regards
Larry
Hi Larry,
I know that using "updateXML" and "insertChildXML" can be more efficient due to the XPath rewrite - however, I'm not sure if this is applicable when the XML is unstructured and non-schema based.XPath rewrite applies to structured (Object-Relational) storage, but to Binary XML and/or XMLIndex as well.
Besides, with Binary XML and a SECUREFILE LOB storage, a "sliding update" is used when the data is written back to disk (only the modified portion of the LOB is affected) thus reducing the overhead of writing whole documents over and over again even for small changes.
For example (OOX_SML_WORKBOOK is a binary XMLType table here) :
-- unstructured XMLIndex with path-subsetting :
CREATE INDEX oox_sml_workbook_uxi1 ON oox_sml_workbook (object_value) INDEXTYPE IS XDB.XMLIndex
PARAMETERS ('PATH TABLE oox_sml_workbook_ptb
PATHS (INCLUDE (/workbook/sheets/sheet)
NAMESPACE MAPPING (xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"))');
-- update of an attribute using updateXML function :
update oox_sml_workbook
set object_value = updateXML( object_value
, '/workbook/sheets/sheet[@sheetId="3"]/@name'
, 'NewName'
, 'xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"' )
where xmlexists('declare default element namespace "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; (::)
/workbook/sheets/sheet[@sheetId="3"]'
passing object_value)
;If you're lucky and currently working with the latest patchset (11.2.0.3), you can also use XQuery Update Facility, a small extension to the XQuery standard that allows various kinds of operations on nodes : inserting (after/before), updating, renaming and deleting.
This extension supersedes the old proprietary functions updateXML, insertXML etc.
And it can be optimized via XPath/XQuery rewrite too :
update oox_sml_workbook
set object_value =
xmlquery('declare default element namespace "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; (::)
copy $d := .
modify (
for $i in $d/workbook/sheets/sheet
return replace value of node $i/@name with concat("MySheet",$i/@sheetId)
return $d'
passing object_value
returning content)
;
Similar Messages
-
Adhoc Query Requirement with Multiple Data Source
Hi All,
I have a Adhoc Query Requirement with Multiple Data Source. Is there any way to achive it. Other than Resultant set and bring into Model.
Thanks
SSYou can compare stuff in the EL, but I don't think this is what you need.
You can just use Java code in the backing bean class for all the business logic. You can use DAO classes for database access logic. Finally for displaying you can use the JSF tags such as h:outputText. -
Obiee with unstructured data source
Hi,
How to work with Unstructured data sources using OBIEE 11g?Anybody any idea?examples would really help.
Is it also available in 10g also?
Please Help.
Regards,
KrishHi Krish,
It's actually possible to use OBIEE with unstructured data.
Even if you don't have real FK relations in your database and a proper model, OBIEE can create queries if you tell him where to find the joins and how they are defined.
The Idea is to create you FK in the physical layer and try to have a 3FN schema (star schema with Dimension and Fact) as much as possbile in your Business layer.
A very nice presentation is available on Mark Rittman webite:
http://www.rittmanmead.com/files/3_Complex_Modeling_with_OBIEE_Elio_Idema.pdf
Hope it will help you to start.
Regards
PS: Please don't forget to close the thread and assign points when your question is answerd -
Query rewrites with Nested materialized views with different aggregations
Platform used : Oracle 11g.
Here is a simple fact table (with measures m1,m2) and dimensions (a) Location (b) Calendar and (c) Product. The business problem is that aggregation operator for measure m1,m2 are different along location dimension and Calendar dimension. The intention is to preaggregate the measures for a product along the calendar dimension and Location dimension and store it as materialized views.
The direct option is to define a materialized view with Inline queries (Because of the different aggrergation operator, it is not possible to write a query without Inline query). http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#BABEAJBF documents the limitations that it works only for 'Text match' and 'Equivalent queries' and that is too limiting.
So decided to have nested materialized view, with first view having just joins(my_dim_mvw_joins), the second view having aggregations along Calendar dimension (my_dim_mvw_calendar) and third view having aggregations along the Location dimension(my_dim_mvw_location). Obviously I do not want the query I fire to know about materialized views and I fire it against the fact table. I see that for the fired query (Which needs aggregations along both Calendar and Location), is rewritten with just second materialized view but not the third. (Had set QUERY_REWRITE_INTEGRITY as TRUSTED) .
Wanted to know whether there are limitations on Query Writes with nested materialized views? Thanks
(Have given a simple testable example below. Pls ignore the values given in 'CALENDAR_IDs', 'PRODUCT_IDs' etc as they are the same for all the queries)
-- Calendar hierarchy table
CREATE TABLE CALENDAR_HIERARCHY_TREE
( "CALENDAR_ID" NUMBER(5,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(5,0),
"HIERARCHY2_ID" NUMBER(5,0),
"HIERARCHY3_ID" NUMBER(5,0),
"HIERARCHY4_ID" NUMBER(5,0),
CONSTRAINT "CALENDAR_HIERARCHY_TREE_PK" PRIMARY KEY ("CALENDAR_ID")
-- Location hierarchy table
CREATE TABLE LOCATION_HIERARCHY_TREE
( "LOCATION_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
CONSTRAINT "LOCATION_HIERARCHY_TREE_PK" PRIMARY KEY ("LOCATION_ID")
-- Product hierarchy table
CREATE TABLE PRODUCT_HIERARCHY_TREE
( "PRODUCT_ID" NUMBER(3,0) NOT NULL ENABLE,
"HIERARCHY1_ID" NUMBER(3,0),
"HIERARCHY2_ID" NUMBER(3,0),
"HIERARCHY3_ID" NUMBER(3,0),
"HIERARCHY4_ID" NUMBER(3,0),
"HIERARCHY5_ID" NUMBER(3,0),
"HIERARCHY6_ID" NUMBER(3,0),
CONSTRAINT "PRODUCT_HIERARCHY_TREE_PK" PRIMARY KEY ("PRODUCT_ID")
-- Fact table
CREATE TABLE RETAILER_SALES_TBL
( "PRODUCT_ID" NUMBER,
"PRODUCT_KEY" VARCHAR2(50 BYTE),
"PLAN_ID" NUMBER,
"PLAN_PERIOD_ID" NUMBER,
"PERIOD_ID" NUMBER(5,0),
"M1" NUMBER,
"M2" NUMBER,
"M3" NUMBER,
"M4" NUMBER,
"M5" NUMBER,
"M6" NUMBER,
"M7" NUMBER,
"M8" NUMBER,
"LOCATION_ID" NUMBER(3,0),
"M9" NUMBER,
CONSTRAINT "RETAILER_SALES_TBL_LOCATI_FK1" FOREIGN KEY ("LOCATION_ID")
REFERENCES LOCATION_HIERARCHY_TREE ("LOCATION_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_PRODUC_FK1" FOREIGN KEY ("PRODUCT_ID")
REFERENCES PRODUCT_HIERARCHY_TREE ("PRODUCT_ID") ENABLE,
CONSTRAINT "RETAILER_SALES_TBL_CALEND_FK1" FOREIGN KEY ("PERIOD_ID")
REFERENCES CALENDAR_HIERARCHY_TREE ("CALENDAR_ID") ENABLE
-- Location dimension definition to promote query rewrite
create DIMENSION LOCATION_DIM
LEVEL CHAIN IS LOCATION_HIERARCHY_TREE.HIERARCHY1_ID
LEVEL CONSUMER_SEGMENT IS LOCATION_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL STORE IS LOCATION_HIERARCHY_TREE.LOCATION_ID
LEVEL TRADING_AREA IS LOCATION_HIERARCHY_TREE.HIERARCHY2_ID
HIERARCHY PROD_ROLLUP (
STORE CHILD OF
CONSUMER_SEGMENT CHILD OF
TRADING_AREA CHILD OF
CHAIN
-- Calendar dimension definition
create DIMENSION CALENDAR_DIM
LEVEL MONTH IS CALENDAR_HIERARCHY_TREE.HIERARCHY3_ID
LEVEL QUARTER IS CALENDAR_HIERARCHY_TREE.HIERARCHY2_ID
LEVEL WEEK IS CALENDAR_HIERARCHY_TREE.CALENDAR_ID
LEVEL YEAR IS CALENDAR_HIERARCHY_TREE.HIERARCHY1_ID
HIERARCHY CALENDAR_ROLLUP (
WEEK CHILD OF
MONTH CHILD OF
QUARTER CHILD OF
YEAR
-- Materialized view with just joins needed for other views
CREATE MATERIALIZED VIEW my_dim_mvw_joins build immediate refresh complete enable query rewrite as
select product_id, lht.HIERARCHY1_ID, lht.HIERARCHY2_ID, lht.HIERARCHY3_ID, lht.location_id, cht.HIERARCHY1_ID year,
cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week, m1, m3, m7, m9
from retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
-- Materialized view which aggregate along calendar dimension
CREATE MATERIALIZED VIEW my_dim_mvw_calendar build immediate refresh complete enable query rewrite as
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID ,location_id, year, quarter, month, week,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total,
GROUPING_ID(product_id, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_joins
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id,
rollup (year, quarter, month, week);
-- Materialized view which aggregate along Location dimension
CREATE MATERIALIZED VIEW my_dim_mvw_location build immediate refresh complete enable query rewrite as
select product_id, year, quarter, month, week, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1,
GROUPING_ID(product_id, HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id, year, quarter, month, week) dim_mvw_gid
from my_dim_mvw_calendar
GROUP BY product_id, year, quarter, month, week,
rollup (HIERARCHY1_ID, HIERARCHY2_ID, HIERARCHY3_ID, location_id)
-- SQL Query Fired (for simplicity have used SUM as aggregation operator for both, but they will be different)
select product_id, year, HIERARCHY1_ID, HIERARCHY2_ID,
sum(m1_total) m1_total_1, sum(m3_total) m3_total_1, sum(m7_total) m7_total_1, sum(m9_total) m9_total_1
from
select product_id, HIERARCHY1_ID , HIERARCHY2_ID , year,
sum(m1) m1_total, sum(m3) m3_total, sum(m7) m7_total, sum(m9) m9_total
from
select product_id, lht.HIERARCHY1_ID , lht.HIERARCHY2_ID , lht.HIERARCHY3_ID ,lht.location_id, cht.HIERARCHY1_ID year, cht.HIERARCHY2_ID quarter, cht.HIERARCHY3_ID month, cht.calendar_id week,m1,m3,m7,m9
from
retailer_sales_tbl RS, calendar_hierarchy_tree cht, location_hierarchy_tree lht
WHERE RS.period_id = cht.CALENDAR_ID
and RS.location_id = lht.location_id
and cht.CALENDAR_ID in (10,236,237,238,239,608,609,610,611,612,613,614,615,616,617,618,619,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477)
AND product_id IN (5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20)
AND lht.location_id IN (2, 3, 11, 12, 13, 14, 15, 4, 16, 17, 18, 19, 20)
GROUP BY product_id, HIERARCHY1_ID , HIERARCHY2_ID , HIERARCHY3_ID , location_id, year
) sales_time
GROUP BY product_id, year,HIERARCHY1_ID, HIERARCHY2_ID
This Query rewrites only with my_dim_mvw_calendar. (as saw in Query Plan and EXPLAIN_MVIEW). But we would like it to use my_dim_mvw_location as that has aggregations for both dimensions.blackhole001 wrote:
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model. -
Query Rewrite with regular database Views
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. However, query rewrite doesn't work no matter how I define the MV and View. Here's an example:
I've Sales tables with columns: PDate, CustCode, Amount
and Customer table with columns: CustCode, CustDesc
I create a view SALES_V with columns: PDate, CustCode, CustDesc, Amount by joining Sales table with Customer table as follows:
create or replace view SALES_V as
select PDate, c.CustCode, c.CustDesc, Amount
from Sales s
join Customer c on (s.CustCode=c.CustCode);
For the sake of speed, I create a materialized view SALES_TOT_MV with columns: PDate, Amount with the following SQL:
create materialized view SALES_TOT_MV
enable query rewrite
as select PDate, sum(Amount) Amount from Sales
group by PDate;
When I run the following query, I expect it to be rewritten to make use of SALES_TOT_MV:
select PDate, sum(Amount) from SALES_V
group by PDate;
However, explain plan always tell me it's using SALES table, not the SALES_TOT_MV.
Can somebody tell me it's a limitation of Oracle optimizer or I'm just missing something for this?
Thanks in advance!!
- Andrew
Edited by: blackhole001 on Jan 28, 2010 12:34 PMblackhole001 wrote:
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model. -
Ejb datacontrol, query panel with timestamps / date field errors
Hi,
I made an ejb datacontrol on a session bean in jdev 11g ps1 and used the named criteria of this entity in the data control to create an af querypanel. This works well.
first thing I cannot configure a date picker with time on this timestamp field (only date ).( does not matter what I configure in the entity datacontrol xml , it does not work )
and displaying the timestamp field in a inputData ( result table ) and showing the time also does not work either.
When I use in the query panel a between query operator on this date or timestamp field I get this error.
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT COUNT(o) FROM RunMessages o WHERE (o.processDate BETWEEN '2009-12-11' AND '2009-12-12')], line 1, column 56: syntax error at [BETWEEN].
Internal Exception: MismatchedTokenException(11!=82)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1241)
<BeanDataCollection><invokeMethod> Exception occurred invoking $Proxy179.queryByRange
java.lang.reflect.InvocationTargetException
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:597)
at oracle.adf.model.adapter.bean.provider.BeanDataCollection.invokeMethod(BeanDataCollection.java:405)
at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.getRecordCount(JPQLBeanDataCollection.java:164)
at oracle.adf.model.adapter.bean.provider.BeanDataCollection.init(BeanDataCollection.java:153)
at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.init(JPQLBeanDataCollection.java:110)
at oracle.adf.model.adapter.bean.provider.BeanDataCollection.refresh(BeanDataCollection.java:380)
at oracle.adf.model.adapter.bean.provider.BeanDataProvider.getDataProvider(BeanDataProvider.java:63)
at oracle.adf.model.adapter.bean.DataFilterHandler.invokeAccessor(DataFilterHandler.java:137)
at oracle.adf.model.adapter.bean.BeanFilterableDataControl.invokeAccessor(BeanFilterableDataControl.java:78)
at oracle.adf.model.bean.DCBeanDataControl.invokeAccessor(DCBeanDataControl.java:447)
at oracle.adf.model.bean.DCDataVO$DCAccessorCollectionAdapter.getDataProvider(DCDataVO.java:2627)
at oracle.adf.model.bean.DCDataVO$DCAccessorCollectionAdapter.refreshIterator(DCDataVO.java:2519)
at oracle.adf.model.bean.DCDataVO.executeQueryForCollection(DCDataVO.java:419)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:1130)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMasters(ViewRowSetImpl.java:1299)
at oracle.jbo.server.ViewRowSetImpl.executeQueryForMode(ViewRowSetImpl.java:1217)
at oracle.jbo.server.ViewRowSetImpl.executeQuery(ViewRowSetImpl.java:1211)
at oracle.jbo.server.ViewObjectImpl.executeQuery(ViewObjectImpl.java:6097)
at oracle.adf.model.bean.DCBeanDataControl.executeIteratorBinding(DCBeanDataControl.java:943)
at oracle.adf.model.binding.DCIteratorBinding.doExecuteQuery(DCIteratorBinding.java:2147)
at oracle.jbo.uicli.binding.MyIteratorBinding.executeQuery(JUAccessorIteratorDef.java:717)
at oracle.jbo.uicli.binding.JUSearchBindingCustomizer.applyAndExecuteViewCriteria(JUSearchBindingCustomizer.java:598)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:424)
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:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1289)
at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.ejb.EJBException: EJB Exception: ; nested exception is:
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT COUNT(o) FROM RunMessages o WHERE (o.processDate BETWEEN '2009-12-11' AND '2009-12-12')], line 1, column 56: syntax error at [BETWEEN].
Internal Exception: MismatchedTokenException(11!=82); nested exception is: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT COUNT(o) FROM RunMessages o WHERE (o.processDate BETWEEN '2009-12-11' AND '2009-12-12')], line 1, column 56: syntax error at [BETWEEN].
Internal Exception: MismatchedTokenException(11!=82)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:109)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:91)
at $Proxy179.queryByRange(Unknown Source)
... 65 more
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [SELECT COUNT(o) FROM RunMessages o WHERE (o.processDate BETWEEN '2009-12-11' AND '2009-12-12')], line 1, column 56: syntax error at [BETWEEN].
Internal Exception: MismatchedTokenException(11!=82)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1241)
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:597)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:93)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
at $Proxy175.createQuery(Unknown Source)
at nl.tennet.mhs.console.model.services.MhsConsoleBean.queryByRange(MhsConsoleBean.java:32)
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:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:55)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy181.queryByRange(Unknown Source)
at nl.tennet.mhs.console.model.services.MhsConsole_ssug8i_MhsConsoleImpl.queryByRange(MhsConsole_ssug8i_MhsConsoleImpl.java:218)
at nl.tennet.mhs.console.model.services.MhsConsole_ssug8i_MhsConsoleImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at nl.tennet.mhs.console.model.services.MhsConsole_ssug8i_MhsConsoleImpl_1032_WLStub.queryByRange(Unknown Source)
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:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:73)
... 66 morewhat happens if you do the following on all three different environments:
SQL> select to_char(exp_date, 'dd-mon-yyyy hh24:mi:ss') from your_table where your_condition ;
[pre] -
Query rewrite with replication Mat. Views
Hi,
Is it possible to have query rewrite using MV's
built from remote tables ?
Thanks for your help
11.20.2Hi,
Yes , it is possible
GRANT GLOBAL QUERY REWRITE system privilege
use explain _rewrite to verify if rewrite works for MV/sql text
DBMS_MVIEW.EXPLAIN_REWRITE (
query VARCHAR2,
mv VARCHAR2(30),
statement_id VARCHAR2(30));
Thanks,
Ajay More -
SQL query result with HTML Data in output
Hello,
I have a SQL table , in one column I store HTML data. I need to query the table and get the HTML data in the columns that have 'HREF'. The output shows as grid on the sql management studio, however when I export it to excel, the HTML data does not get copied
correctly, since there are HTML tags etc.
How can I export the report correctly from SQL ?Hello,
The HTML data is stored in a column with datatype as nvarchar(max). Sample data in the column is shown below. It is with formatting etc and is rendered as is on the web page. the business wants to generate a quick report so that they can see the pages that
have links displayed. I can do that by querying the columns that have a 'HREF' in the text.
Can I get the exact HREF values using just sql query? There can be more than one links on a page.
Also, If I just want to copy the whole column and paste it on excel, how can I do that? If I copy the data below and paste, it does not get copied in one cell.. it spreads across multiple cells, so the report does not make any sense.
<br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 431pt; border-collapse: collapse;" width="574">
<tbody>
<tr height="19" style="height: 14.25pt; ">
<td height="19" style="border: 0px blue; width: 431pt; height: 14.25pt; background-color: transparent;" width="574"><a href="https:"><u><font color="#0066cc" face="Calibri">ax </font></u></a></td>
</tr>
</tbody>
<colgroup>
<col style="width: 431pt; " width="574" />
</colgroup>
</table> -
Query problem with multiple date fields.
I need to select the greatest date from six different fields in each record and identify from which column was selected.
date01 date02 date03 date04 date05 date06
010190 010107 010190 010190 010190 010190
010190 010190 010105 010190 010190 010190
010103 010190 010190 010190 010190 010190
1)if greatest is in date01 then S = 1
2)if greatest is in date02 then S = 2
3)if greatest is in date03 then S = 3
4)if greatest is in date04 then S = 4
5)if greatest is in date05 then S = 5
6)if greatest is in date06 then S = 5
Do you have any idea on how to acomplish this?
ThanksAnother way (won't work for null dates):
with
the_data as
(select to_date('01011990','DDMMYYYY') col1,to_date('01012007','DDMMYYYY') col2,to_date('01011990','DDMMYYYY') col3,
to_date('01011990','DDMMYYYY') col4,to_date('01011990','DDMMYYYY') col5,to_date('01011990','DDMMYYYY') col6
from dual union all
select to_date('01011990','DDMMYYYY'),to_date('01011990','DDMMYYYY'),to_date('01012005','DDMMYYYY'),
to_date('01011990','DDMMYYYY'),to_date('01011990','DDMMYYYY'),to_date('01012005','DDMMYYYY')
from dual union all
select to_date('01012003','DDMMYYYY'),to_date('01011990','DDMMYYYY'),to_date('01012003','DDMMYYYY'),
to_date('01011990','DDMMYYYY'),to_date('01012003','DDMMYYYY'),to_date('01011990','DDMMYYYY')
from dual
the_setup as
(select rownum the_row,col1,col2,col3,col4,col5,col6,greatest(col1,col2,col3,col4,col5,col6) the_greatest,
to_char(col1,'DDMMYYYY') || to_char(col2,'DDMMYYYY') || to_char(col3,'DDMMYYYY') ||
to_char(col4,'DDMMYYYY') || to_char(col5,'DDMMYYYY') || to_char(col6,'DDMMYYYY') dates
from the_data
the_columns as
(select the_row,
max(decode(position,1,'1,')) || max(decode(position,2,'2,')) || max(decode(position,3,'3,')) ||
max(decode(position,4,'4,')) || max(decode(position,5,'5,')) || max(decode(position,6,'6,')) the_cols
from (select distinct the_row,level position
from the_setup
where substr(dates,8 * (level - 1) + 1,8) = the_greatest
connect by level <= 6
group by the_row
select col1,col2,col3,col4,col5,col6,the_greatest,rtrim(the_cols,',') the_columns
from the_setup s,the_columns c
where s.the_row = c.the_row
order by s.the_row
==========================================================================================================
COL1 | COL2 | COL3 | COL4 | COL5 | COL6 | THE_GREATEST | THE_COLUMNS
==========================================================================================================
01.01.1990 | 01.01.2007 | 01.01.1990 | 01.01.1990 | 01.01.1990 | 01.01.1990 | 01.01.2007 | 2
01.01.1990 | 01.01.1990 | 01.01.2005 | 01.01.1990 | 01.01.1990 | 01.01.2005 | 01.01.2005 | 3,6
01.01.2003 | 01.01.1990 | 01.01.2003 | 01.01.1990 | 01.01.2003 | 01.01.1990 | 01.01.2003 | 1,3,5Regards
Etbin -
I am querying for distinct data from one table but I need
only the most recent data. I am currently using the query included
below, but if there are two entries for any of the paddocks and the
species are different in them I will get both entries returned. I
need it to return just the most recent of those two entries. How do
I do this??
If this were my data I would only want it to return: 1, cool
and 2, warm
Paddock Species Date
1 Warm 1/1/05
1 Cool 1/7/05
2 1/5/05
2 Warm 1/7/05
<cfquery name="getpaddocks" datasource="dairy">
SELECT this.paddock, this.species
FROM
(select distinct paddock, species
FROM dairy.dbo.paddockdata
WHERE FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp)
)as this
ORDER BY RIGHT('00000' + paddock, 3)
</cfquery>something like this might work
select p.paddock thepaddock, p.species thespecies
from paddockdata p join
select paddock tpaddock, species tspecies, max(datadate)
maxdate
from paddockdata
where FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp)
group by paddock, species
) temp on paddock = tpaddock and species = tspecies and
datadate = maxdate
where FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp) -
Query options with Master Data
Good Morning SAP Guru's-
Is there a transaction I can use to search if I don't know if I have a customer, sold-to or ship to number? I need functionality to search and find a hit with any of these.
Thanks!
POINTS PROMISEDHi,
Other useful tables:
FTYP - FI Partner Function Types
J_1BAD - Partner function ID
J_1BADT - Partner function description
KNVP - Customer Master Partner Functions
PFFCT - Period-End Partner: Functions
PFFCTT - Period-End Partner: Functions (Text)
T061V - FI-ARI: Texts for external partner functions
T606PG - Legal Control: Partner Functions for Grouping Partners
TPAKL - Assignment of Partner Function to Account
TPAR - Business Partner: Functions
TPART - Business Partner Functions: Texts
TPAUM - Business partner: Language conversion for
TPFKT - Contact Partner Functions: Texts
TQ83 - Partner Functions for Codes
TVKB - Sales Activities : Authorization for Partn
TVPG - Partner Function Groups
VAKPA - Sales Index: Orders by Partner Function
VBKOF - SD index: Open sales activities by partner
VBKPA - SD index: Sales activities by partner func
VLKPA - SD Index: Deliveries by Partner Functions
VRKPA - Sales Index: Bills by Partner Functions
WYT3 - Partner Functions
TBE32T - P&S BTE: Partner Function Module Descripti
TCMS_BPF - Business Partner Functions ( Customizing)
TCMS_BPF_BPF_SET - Business Partner Function Sets
TCMS_BPF_CAT - Business Partner Function Category
TCMS_BPF_CAT_T - Business Partner Function Category (Text t
TCMS_BPF_SET - Business Partner Function Sets
TCMS_BPF_SET_T - Business Partner Function Sets
TCMS_BPF_T - Business Partner Function Texts
TCMS_FSBP_R2F - Mapping FSBP-Role to CMS-Partner Function
TNAPN - Output Control: Output By Partner Function
TP15 - Business Partner: Function
TP15T - Business partner: Name of Function
TPAER - Business Partner: Functions in Partner Det
TPAER_PM - Partner Functions in Partner Schema (PM) w
TPAKD - Business Partner: Valid Acct Groups per Pa
Regards,
Naveen. -
Query rewrite for COUNT(DISTINCT)
Hi,
I am having fact table with different dimension keys.
CREATE TABLE FACT
TIME_SKEY NUMBER
REGION_SKEY NUMBER,
AC_SKEY NUMBER
I need to take COUNT(DISTINCT(AC_SKEY) for TIME_SKEY and REGION_SKEY. There are oracle dimension defined for time and region which are using TIME_SKEY and REGION_SKEY. I have created MV with query rewrite with COUNT(DISTINCT) but it is not using dimension if I am using any other level and MV can't be fast refreshed as it was build using COUNT(DISTINCT).
CREATE MATERIALIZED VIEW AC_MV
NOCACHE
NOLOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT
TIME_SKEY ,
REGION_SKEY,
COUNT (DISTINCTAC_SKEY)
FROM FACT
GROUP BY TIME_SKEY, REGION_SKEY;
Query used to retrieve data is as below
SELECT TIME_SKEY, COUNT(DISTINCT AC_SKEY) OVER (PARTITION BY TIME_SKEY) UNIQ_AC, COUNT(DISTINCT AC_SKEY) OVER () UNIQ_AC1
FROM FACT;
There can be other queries based on time / region dimension.
Can you please provide help in solving above issue?
Thanks,
PriteshWhat version of the Oracle database?
-
Are Cube organized materialized view with Year to Date calculated measure eligible for Query Rewrite
Hi,
Will appreciate if someone can help me with a question regarding Cube organized MV (OLAP).
Does cube organized materialized view with calculated measures based on time series Year to date, inception to date eg.
SUM(FCT_POSITION.BASE_REALIZED_PNL) OVER (HIERARCHY DIM_CALENDAR.CALENDAR BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT DIMENSION LEVEL DIM_CALENDAR."YEAR")
are eligible for query rewrites or these are considered advanced for query rewrite purposes.
I was hoping to find an example with YTD window function on physical fact dim tables with optimizer rewriting it to Cube Org. MV but not much success.
Thanks in advanceI dont think this is possible.
(My own reasoning)
Part of the reason query rewrite works for base measures only (not calc measures in olap like ytd would be) is due to the fact that the data is staged in olap but its lineage is understandable via the olap cube mappings. That dependency/source identification is lost when we build calculated measures in olap and i think its almost impossible for optimizer to understand the finer points relating to an olap calculation defined via olap calculation (olap dml or olap expression) and also match it with the equivalent calculation using relational sql expression. The difficulty may be because both the olap ytd as well as relational ytd defined via sum() over (partition by ... order by ...) have many non-standard variations of the same calculation/definition. E.g: You can choose to use or choose not to use the option relating to IGNORE NULLs within the sql analytic function. OLAP defn may use NASKIP or NASKIP2.
I tried to search for query rewrite solutions for Inventory stock based calculations (aggregation along time=last value along time) and see if olap cube with cube aggregation option set to "Last non-na hierarchical value" works as an alternative to relational calculation. My experience has been that its not possible. You can do it relationally or you can do it via olap but your application needs to be aware of each and make the appropriate backend sql/call. In such cases, you cannot make olap (aw/cubes/dimensions) appear magically behind the scenes to fulfill the query execution while appearing to work relationally.
HTH
Shankar -
Formula Created in BI Query appears in Universe as Measure with No Data
Hi,
I have created the universe on top of SAP BI Query(Which is built on Infoset).
There are some formulas created in BI Query as mentioned below:
Eg: Status1=
If Completion Code = null then Status1 = 0
If Completion Code = =10,11,18 then Status1 = 1
Status2=
If Status1= 1 and Field Completion Date <= Regulatory Due Date then Status 2 = 3
If Status1= 0 and Report Date <= Regulatory Due Date then Status 2 = 4
In the Universe I get Status1 and Status2 as Measures.
When I use these Measure Objects in WebI report, I donu2019t see any Data for these objects in WebI Report. Both the columns for Status1 and Status2 appear Blank with no data in it, although I get the data in SAP BI Query for both Status1 and status2.
Is there any issue with the formulas to be used in SAP BI Query?
Are Formulas supported in Business Objects from SAP BI Query?
regards,
NishaHi Ingo,
I tried running the standard test MDX in MDXTEST and I got the data for those calculations.
But I wonder why there is no data in WebI for those formulas(Key Figures)?
In Standard test MDX the MDX Query is as Follows:
SELECT
[Measures].MEMBERS ON COLUMNS,
NON EMPTY [Z_WM_IS01___F98].[LEVEL01].MEMBERS ON ROWS
FROM ZWM_M02/Z_ZWM_M02_Q001 SAP VARIABLES
[!V000001] INCLUDING [Z_WM_IS01___F15].[3]
Based on above Query I created the WebI report which includes the objects as described below:
one Dimension Object Notification Number which is equivalent to [Z_WM_IS01___F98].[LEVEL01].MEMBERS from above query.
Selected All the measures objects available in query which refers to [Measures].MEMBERS
And one Prompt on Region which is equivalent to [!V000001] INCLUDING [Z_WM_IS01___F15].[3]
Why there is no data for Calculation columns (Key Figures Status1 and Status2) in WebI Report??? -
Query Not reflected with Updated Data
Dear Experts,
I am facing a Problem in query data updation. Data has been daily updating in infoprovider successfully ,But when user run query through Bex he is always shown old data. Then I go to RSRT and generate the query and data got updated.
Every Time for new data updation I need to Generate the query.
What could be reason for this. Is this related to cache data ?
Any Advise .
Thanks in Advance.Dear Michael,
This problem is coming only for one Multiprovider. Running this program would affect all other queries also . This will Delay the reporting.
Any other reason why query is reflected with old data Though infoprovide is loaded with new data.
Maybe you are looking for
-
DPM 2010 Shell Cmdlets usage leading to Powershell crash
Hi all, I have 71 DPM 2010 servers located at various places in the world. The most of them have a good and reliable network connection while some of them are connected via Sat-Link. All of my DPM 2010 servers have the same version, and are all runni
-
Schema information was not read from MDS Repository
Hi All, When running the SCA Components and reading the schemas information, we are facing issues, like.... " Schema information was not read from MDS Repository " and the instances are getting failed. this is not happending that regularly, but when
-
Palm Desktop Palm T/X sync issues
I'm new to the board but I need help. I have T/X that I have used for awhile. Upgraded my PC to windows7 Bit, do not use Outlook as my desktop PIM but Chaos Intellect. I sync Intellect to Palm desktop with companionlink, the sync Palm desktop to m
-
Active/selected photo and flag
I used lightroom 3 and i test lightroom 5. I have the same problem in the 2 app. In survey mode, when i want to set flag to the active photo lightroom set the flag to all the selected photos .
-
No Full Screen through Keynote on iPad connected to a tv
When I connect my iPad to the tv for a keynote presentation via the apple av/component cable the presentation does not fill the screen but is in the center leaving large black spaces on the sides of the slide. Is there a way to change this?