Intra - Partioning Query

Hi,
I'm trying to create an Intra Partioning Query but need a bit of help.
What i have so far is:
Select call_id,
Sum(decode(start_date_time (To_Date('12-JAN-2006', 'DD-MON-YYYY')), charge, NULL)) Charge12,
Sum(decode(start_date_time (To_Date('19-MAR-2006', 'DD-MON-YYYY')), charge, NULL)) Charge19,
Sum(decode(start_date_time (To_Date('12-JAN-2006', 'DD-MON-YYYY')), charge, NULL)) -
Sum(decode(start_date_time (To_Date('19-MAR-2006', 'DD-MON-YYYY')), charge, NULL)) diff
From phone_call
Group By call_id;
The error i'm getting is that it doesnot recognise "start_date_time.
I have checked the spelling and it matches up.
Appreciate any help
Thanks

you are missing Comms in decode after column
Select call_id,
Sum(decode(start_date_time  ,  (To_Date('12-JAN-2006', 'DD-MON-YYYY')), charge, NULL)) Charge12,
Sum(decode(start_date_time ,  (To_Date('19-MAR-2006', 'DD-MON-YYYY')), charge, NULL)) Charge19,
Sum(decode(start_date_time ,  (To_Date('12-JAN-2006', 'DD-MON-YYYY')), charge, NULL)) -
Sum(decode(start_date_time ,  (To_Date('19-MAR-2006', 'DD-MON-YYYY')), charge, NULL)) diff
From phone_call
Group By call_id;

Similar Messages

  • Sybase gateway problem - Failed to load dynamic library 'hsdbsyb'

    Having problems getting the Sybase gateway working on XP. Environment in Oracle 9.2.0.6 on Linux, Sybase on AIX 5.1 (moving to linux, gateway currently working well on this box) gateway on XP. I get the following error when trying to use my db link: Help appreciated
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Transparent gateway for SYBASE]DRV_InitTdp: DBTYPE.C (473): ; The specified module could not be found.
    ; at FIND_IMAGE_SYMBOL
    DBTYPE.C (7): ; [C079] Failed to load dynamic library 'hsdbsyb'
    tnsnames on linux box has:
    CIT001TSTW =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = tcp)(HOST = lons00106694)(PORT = 1521))
    (CONNECT_DATA =
    (SID = cit001tst)
    (HS = OK)
    on gateway windows box (has oracle client and gateway software and sybase client)
    listener.ora:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = extproc)
    (SID_DESC=
    (SID_NAME = cit001tst)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = tg4sybs)
    initcit001tst.ora
    HS_FDS_CONNECT_INFO=CIT1_LON_TST_SQL.cit001tst
    HS_FDS_TRACE_LEVEL=ON
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_FDS_TRACE_LEVEL=4
    HS_FDS_FILE_NAME=trace
    # Environment variables required for Sybase
    set SYBASE=c:\progra~1\sybase\oc1251
    sql.ini
    [CIT1_LON_TST_SQL]
    win3_query=WNLWNSCK,loncmxs0004.uk.net.intra.,5000
    query=NLWNSCK,loncmxs0004.uk.net.intra.,5000

    Yes, this VI is damaged. I can not open it.
    Colin
    LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2013; testing system development
    Please Mark the solution as accepted if your problem is solved and donate kudoes
    Home--www.colinzhang.net

  • DeadLocks on e_waitPipeNewRow Wait type

    Hi Experts,
    We are receiving hundread deadlocks daily with WaitType = "e_waitPipeNewRow". I am not sure why these deadlock occuring on prod server. I suspect this is reated to something to SSIS packages that are running on machine plus some latest
    updates are missing on servers. Can you guys please throw some light on this and provide the solution to get rid of this.
    Shivraj Patil.

    Hi experts,
    Which kind of this deadlock is normal or Intra para query dead lock , beacuse i see Page Lock keyword in Graph.
    <deadlock>
    <victim-list>
    <victimProcess id="process2b41ce08" />
    </victim-list>
    <process-list>
    <process id="process2b41ce08" taskpriority="0" logused="360" waitresource="PAGE: 10:5:451520" waittime="3255" ownerId="13432730290" transactionname="UPDATE" lasttranstarted="2014-11-25T19:26:25.777" XDES="0xe8b07d970" lockMode="IU" schedulerid="23" kpid="250372" status="suspended" spid="281" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-11-25T19:26:25.327" lastbatchcompleted="2014-11-25T19:26:25.327" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" loginname="INTRANET\sysCWBASPNET" isolationlevel="read committed (2)" xactid="13432730290" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="259" stmtstart="27128" stmtend="29648" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf>
    Proc [Database Id = 10 Object Id = 1822850502] </inputbuf>
    </process>
    <process id="process3243bb88" taskpriority="0" logused="10000" waittime="3156" schedulerid="36" kpid="281440" status="suspended" spid="277" sbid="0" ecid="2" priority="0" trancount="0" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf />
    </process>
    <process id="process32458bc8" taskpriority="0" logused="10000" waittime="3181" schedulerid="39" kpid="277808" status="suspended" spid="277" sbid="0" ecid="3" priority="0" trancount="0" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf />
    </process>
    <process id="process32431b88" taskpriority="0" logused="10000" waittime="3166" schedulerid="35" kpid="253808" status="suspended" spid="277" sbid="0" ecid="4" priority="0" trancount="0" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf />
    </process>
    <process id="process32445708" taskpriority="0" logused="10000" waittime="3203" schedulerid="37" kpid="277024" status="suspended" spid="277" sbid="0" ecid="1" priority="0" trancount="0" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf />
    </process>
    <process id="process5c4ee08" taskpriority="0" logused="10000" waittime="3136" schedulerid="18" kpid="261740" status="suspended" spid="277" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" loginname="INTRANET\sysCWBASPNET" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf>
    Proc [Database Id = 10 Object Id = 1822850502] </inputbuf>
    </process>
    <process id="process32444988" taskpriority="0" logused="1138880" waitresource="PAGE: 10:12:435718" waittime="3258" ownerId="13432730596" transactionname="UPDATE" lasttranstarted="2014-11-25T19:26:25.800" XDES="0x18cb1136e0" lockMode="U" schedulerid="37" kpid="261676" status="suspended" spid="277" sbid="0" ecid="8" priority="0" trancount="0" lastbatchstarted="2014-11-25T19:26:25.287" lastbatchcompleted="2014-11-25T19:26:25.287" clientapp=".Net SqlClient Data Provider" hostname="LDNPSM032220" hostpid="2240" isolationlevel="read committed (2)" xactid="13432730596" currentdb="10" lockTimeout="4294967295" clientoption1="538970208" clientoption2="128056">
    <executionStack>
    <frame procname="" line="279" stmtstart="29650" stmtend="30242" sqlhandle="0x03000a00c67da66c2575ac0051a300000100000000000000" />
    </executionStack>
    <inputbuf />
    </process>
    </process-list>
    <resource-list>
    <pagelock fileid="5" pageid="451520" dbid="10" objectname="" id="lock178f827f80" mode="UIX" associatedObjectId="72057604489740288">
    <owner-list>
    <owner id="process5c4ee08" mode="IX" />
    <owner id="process5c4ee08" mode="U" />
    </owner-list>
    <waiter-list>
    <waiter id="process2b41ce08" mode="IU" requestType="wait" />
    </waiter-list>
    </pagelock>
    <exchangeEvent id="Pipe149719eb00" WaitType="e_waitPipeGetRow" nodeId="8">
    <owner-list>
    <owner id="process32444988" />
    </owner-list>
    <waiter-list>
    <waiter id="process3243bb88" />
    </waiter-list>
    </exchangeEvent>
    <exchangeEvent id="Pipe149719eb80" WaitType="e_waitPipeGetRow" nodeId="8">
    <owner-list>
    <owner id="process32444988" />
    </owner-list>
    <waiter-list>
    <waiter id="process32458bc8" />
    </waiter-list>
    </exchangeEvent>
    <exchangeEvent id="Pipe149719ec00" WaitType="e_waitPipeGetRow" nodeId="8">
    <owner-list>
    <owner id="process32444988" />
    </owner-list>
    <waiter-list>
    <waiter id="process32431b88" />
    </waiter-list>
    </exchangeEvent>
    <exchangeEvent id="Pipe149719ea80" WaitType="e_waitPipeGetRow" nodeId="8">
    <owner-list>
    <owner id="process32444988" />
    </owner-list>
    <waiter-list>
    <waiter id="process32445708" />
    </waiter-list>
    </exchangeEvent>
    <exchangeEvent id="Pipe149719e300" WaitType="e_waitPipeGetRow" nodeId="3">
    <owner-list>
    <owner id="process32445708" />
    <owner id="process3243bb88" />
    <owner id="process32458bc8" />
    <owner id="process32431b88" />
    </owner-list>
    <waiter-list>
    <waiter id="process5c4ee08" />
    </waiter-list>
    </exchangeEvent>
    <pagelock fileid="12" pageid="435718" dbid="10" objectname="" id="lockdfda7ef80" mode="IX" associatedObjectId="72057604489740288">
    <owner-list>
    <owner id="process2b41ce08" mode="IX" />
    </owner-list>
    <waiter-list>
    <waiter id="process32444988" mode="U" requestType="wait" />
    </waiter-list>
    </pagelock>
    </resource-list>
    </deadlock>
    Shivraj Patil.

  • Getting Strange Error Running Query After Partioning Cube

    I am using BI 7.0, Service Pack 11:
    I just partitioned a cube. I hav eorginal cube XFI_C001 and create a new cube C2_XFIC01 by copying from XFI_C001. Now I developed a query on C2_XFIC01. Similar query on XFI_C001 does not give any error. How can I debug this problem? Error reported when running query is shown below. I  ran ST22, no dump. I did SM50, looked at developer trace, no clue.
    The initial exception that caused the request to fail was: 
    Termination message sent
    ABEND RSBOLAP (000): Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
      MSGV1: SAPMSSY1
      MSGV3: UNCAUGHT_EXCEPTION
    com.sap.ip.bi.base.application.exceptions.AbortMessageRuntimeException: Termination message sent
    ABEND RSBOLAP (000): Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
      MSGV1: SAPMSSY1
      MSGV3: UNCAUGHT_EXCEPTION
    at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessageInternal(MessageManager.java:148)
    at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessage(MessageManager.java:113)
    Detailed Exception is:
    com.sap.ip.bi.base.exception.BIBaseRuntimeException: Error while generating HTML
         at com.sap.ip.bi.webapplications.ui.items.UiItem.render(UiItem.java:365)
         at com.sap.ip.bi.webapplications.runtime.rendering.impl.ContainerNode.render(ContainerNode.java:63)
         at com.sap.ip.bi.webapplications.runtime.rendering.impl.PageAssemblerRenderingRoot.processRendering(PageAssemblerRenderingRoot.java:52)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRenderingRootNode(Page.java:3565)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRendering(Page.java:3280)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.doProcessRequest(Page.java:3236)
         at com.sap.ip.bi.webapplications.runtime.impl.Page.processRequest(Page.java:2512)
         at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.doProcessRequest(Controller.java:956)
         at com.sap.ip.bi.webapplications.runtime.controller.impl.Controller.processRequest(Controller.java:842)
         at com.sap.ip.bi.webapplications.runtime.jsp.portal.services.BIRuntimeService.handleRequest(BIRuntimeService.java:430)
         at com.sap.ip.bi.webapplications.runtime.jsp.portal.components.LauncherComponent.doContent(LauncherComponent.java:21)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:174)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Caused by: com.sap.ip.bi.base.application.exceptions.AbortMessageRuntimeException: Termination message sent
    ABEND RSBOLAP (000): Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
      MSGV1: SAPMSSY1
      MSGV3: UNCAUGHT_EXCEPTION
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessageInternal(MessageManager.java:148)
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessage(MessageManager.java:113)
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessageInternal(MessageManager.java:144)
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessage(MessageManager.java:113)
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessageInternal(MessageManager.java:144)
         at com.sap.ip.bi.base.application.message.impl.MessageManager.addMessage(MessageManager.java:113)
         at com.sap.ip.bi.base.application.service.RfcService.fillMessages(RfcService.java:268)
         at com.sap.ip.bi.base.application.service.RfcService.doPostProcessing(RfcService.java:218)
         at com.sap.ip.bi.base.application.service.rfcproxy.impl.RfcFunction.execute(RfcFunction.java:57)
         at com.sap.ip.bi.base.application.service.RfcService.doPostProcessing(RfcService.java:227)
         at com.sap.ip.bi.base.application.service.rfcproxy.impl.RfcFunction.execute(RfcFunction.java:57)
         at com.sap.ip.bi.bics.dataaccess.resource.impl.bi.selector.ProviderInfoObject.prepareForSelectionMemberAccess(ProviderInfoObject.java:1215)
         at com.sap.ip.bi.bics.dataaccess.resource.impl.bi.selector.selection.ProviderComponentList.setup(ProviderComponentList.java:87)
         at com.sap.ip.bi.bics.dataaccess.resource.impl.bi.selector.selection.ProviderComponentList.getComponents(ProviderComponentList.java:120)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.selection.ComponentList.setup(ComponentList.java:96)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.selection.ComponentList.<init>(ComponentList.java:77)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.selection.CartesianProduct.setup(CartesianProduct.java:78)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.selection.CartesianProduct.<init>(CartesianProduct.java:55)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.selection.Selection.<init>(Selection.java:57)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.SelectionObject.createSelection(SelectionObject.java:538)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.SelectionObject.getSelectionSpace(SelectionObject.java:549)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.selector.SelectionObject.getEffectiveSelection(SelectionObject.java:577)
         at com.sap.ip.bi.km.impl.KmUtilities.getEffectiveSelection(KmUtilities.java:66)
         at com.sap.ip.bi.km.impl.source.property.QueryBuilderMulti.getQueryExpressionWrapper(QueryBuilderMulti.java:129)
         at com.sap.ip.bi.km.impl.source.CmFolderSource.getDocumentQueryResult(CmFolderSource.java:132)
         at com.sap.ip.bi.km.common.selection.DocumentSelectorResultSet.readQvDocuments(DocumentSelectorResultSet.java:234)
         at com.sap.ip.bi.km.common.selection.DocumentSelectorResultSet.getCellsWithDocuments(DocumentSelectorResultSet.java:136)
         at com.sap.ip.bi.km.common.selection.DocumentsSelectionService.getCellsWithDocuments(DocumentsSelectionService.java:258)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsDataCells.hasDocuments(RsDataCells.java:620)
         at com.sap.ip.bi.bics.dataaccess.consumer.impl.queryview.resultset.RsDataCell.hasDocuments(RsDataCell.java:543)
         at com.sap.ip.bi.webapplications.ui.items.analysis.renderer.interactive.RendererInteractive.createContent_DocumentSymbol(RendererInteractive.java:1660)
         at com.sap.ip.bi.webapplications.ui.items.analysis.renderer.interactive.RendererInteractive.createCell_Content(RendererInteractive.java:545)
         at com.sap.ip.bi.webapplications.ui.items.analysis.renderer.interactive.RendererInteractive.createCell(RendererInteractive.java:525)
         at com.sap.ip.bi.webapplications.ui.items.analysis.renderer.interactive.RendererInteractive.createTableRow(RendererInteractive.java:489)
         at com.sap.ip.bi.webapplications.ui.items.analysis.renderer.interactive.RendererInteractive.getContent(RendererInteractive.java:423)
         at com.sap.ip.bi.webapplications.ui.items.analysis.control.AcPivotTableInteractive.buildUrTree(AcPivotTableInteractive.java:321)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:33)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:61)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayoutItem.iterateOverChildren(FlowLayoutItem.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayout.iterateOverChildren(FlowLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:61)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayoutCell.iterateOverChildren(MatrixLayoutCell.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayoutRow.iterateOverChildren(MatrixLayoutRow.java:56)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.MatrixLayout.iterateOverChildren(MatrixLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.container.matrixlayout.control.AcMatrixControlGrid.iterateOverChildren(AcMatrixControlGrid.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:61)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.Group.iterateOverChildren(Group.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.container.group.control.AcGroupControl.iterateOverChildren(AcGroupControl.java:259)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.advancedcontrols.bridge.AcItemBridge.iterateOverChildren(AcItemBridge.java:61)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayoutItem.iterateOverChildren(FlowLayoutItem.java:63)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.unifiedrendering.controls.FlowLayout.iterateOverChildren(FlowLayout.java:69)
         at com.sap.ip.bi.webapplications.ui.framework.base.impl.CompositeBuildUrTreeTrigger.process(CompositeBuildUrTreeTrigger.java:36)
         at com.sap.ip.bi.webapplications.ui.framework.base.composites.UiRootContainer.iterateOverChildren(UiRootContainer.java:40)
         ... 42 more

    Hi,
    The error log shows you are executing your query on portal which uses Java stack. There may some issue with the portal configuration. Check with your basis/portal team.
    The query will execute in BEx and RSRT as RSRT executes query on ABAP stack.
    Regards,Niraj

  • Help running a query in CF

    Hello - I'm able to run the following query in MS Access:
    SELECT *
    FROM p_retreat
    WHERE ((Not (p_retreat.sessions)=" "));
    When I try to run it from a ColdFusion page I get the error
    below. I would appreciate any suggestions for running this query in
    CF.:
    Error Diagnostic Information
    ODBC Error Code = 07001 (Wrong number of parameters)
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
    Expected 1.
    Hint: The cause of this error is usually that your query
    contains a reference to a field which does not exist. You should
    verify that the fields included in your query exist and that you
    have specified their names correctly.
    SQL = "select code, lastname, firstname, sessions from
    p_retreat WHERE ((Not (p_retreat.sessions)=" ")) order by lastname"
    Data Source = "TRAINING_CALENDAR"
    The error occurred while processing an element with a general
    identifier of (CFQUERY), occupying document position (19:1) to
    (19:54).
    Date/Time: 09/08/06 15:27:31
    Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
    .NET CLR 1.1.4322)
    Remote Address: 10.1.5.55
    HTTP Referrer:
    http://intra/cfapps/register/retreat_report.cfm

    use single quotes ' ' not double.
    In addition the ; will probably cause an error too.
    HTH
    Tim Carley
    www.recfusion.com
    [email protected]

  • Help needed in tuning this query

    This is the SQL i would like to tune for performace...
    The table structure is given below.
    The table has about 2 million rows.
    From the second day onwards only around 10% of records will be between Load_Start_Time and Load_End_Time. Among these around 50% will have THAMES_URN_WITH_ROLE_SUFFIX as 'TP%'. At present there are unique and primary key indexes on THAMES_URN_WITH_ROLE_SUFFIX .
    I'm sure that we need a b-tree index on STG_UPDATE_DATE_TIME as it is the column with good selectivity.
    I'm primarily concerned about the substr, instr and reverese on THAMES_URN_WITH_ROLE_SUFFIX.
    Also pls. let me know if the order of predicates is right.
    Thanks in advance.
    SELECT TPD_STG_TL_SF_LEGAL_OWNER.THAMES_URN, TPD_STG_TL_SF_LEGAL_OWNER.UPDATE_SOURCE, TPD_STG_TL_SF_LEGAL_OWNER.SOURCE_EXTRACT_DATE_TIME, TPD_STG_TL_SF_LEGAL_OWNER.LEGAL_OWNERSHIP_ISSUE_IND, TPD_STG_TL_SF_LEGAL_OWNER.CONTACTABLE_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.ADMIN_CONTROL_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.BANKRUPTCY_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.ASSIGNED_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.IN_TRUST_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.DIVORCE_CASE_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.POA_COP_INDICATOR, TPD_STG_TL_SF_LEGAL_OWNER.CLEANSING_STATUS, TPD_STG_TL_SF_LEGAL_OWNER.CATEGORY
    FROM
    TPD_STG_TL_SF_LEGAL_OWNER
    WHERE
    ((TPD_STG_TL_SF_LEGAL_OWNER.STG_UPDATE_DATE_TIME > '$$Load_Start_Time'
    AND
    TPD_STG_TL_SF_LEGAL_OWNER.STG_UPDATE_DATE_TIME <= '$$Load_End_Time')
    OR
    (TPD_STG_TL_SF_LEGAL_OWNER.TPDB_PROCESSED_IDENTIFIER != 'Y') )
    AND
    SUBSTR(TPD_STG_TL_SF_LEGAL_OWNER.THAMES_URN_WITH_ROLE_SUFFIX,1,2)='TP'
    AND
    SUBSTR(REVERSE( TPD_STG_TL_SF_LEGAL_OWNER.THAMES_URN_WITH_ROLE_SUFFIX),INSTR(REVERSE( TPD_STG_TL_SF_LEGAL_OWNER.THAMES_URN_WITH_ROLE_SUFFIX),'-',1)-1,1)!='S'
    ========================================
    CREATE TABLE TPD_STG_TL_SF_LEGAL_OWNER
    THAMES_URN VARCHAR2(35 BYTE) NOT NULL,
    UPDATE_SOURCE VARCHAR2(3 BYTE),
    SOURCE_EXTRACT_DATE_TIME DATE,
    LEGAL_OWNERSHIP_ISSUE_IND CHAR(1 BYTE),
    CONTACTABLE_INDICATOR CHAR(1 BYTE),
    ADMIN_CONTROL_INDICATOR CHAR(1 BYTE),
    BANKRUPTCY_INDICATOR CHAR(1 BYTE),
    ASSIGNED_INDICATOR CHAR(1 BYTE),
    IN_TRUST_INDICATOR CHAR(1 BYTE),
    DIVORCE_CASE_INDICATOR CHAR(1 BYTE),
    POA_COP_INDICATOR CHAR(1 BYTE),
    THAMES_URN_WITH_ROLE_SUFFIX VARCHAR2(39 BYTE),
    THAMES_LEGAL_OWNERSHIP_IND CHAR(1 BYTE),
    PRODUCT_HOLDING_ROLE_TYPE VARCHAR2(21 BYTE),
    OWNERSHIP_SPLIT_PERCENTAGE NUMBER(3),
    SOURCE_SYSTEM VARCHAR2(3 BYTE),
    TITLE VARCHAR2(50 BYTE),
    FIRST_NAME VARCHAR2(50 BYTE),
    MIDDLE_INITIAL VARCHAR2(50 BYTE),
    SURNAME VARCHAR2(50 BYTE),
    GENDER CHAR(1 BYTE),
    BIRTH_DATE DATE,
    DEATH_INDICATOR CHAR(1 BYTE),
    DEATH_RECORD_DATE DATE,
    NATIONAL_INSURANCE_NUMBER VARCHAR2(9 BYTE),
    GONE_AWAY_INDICATOR CHAR(1 BYTE),
    ADDRESS_LINE_1 VARCHAR2(50 BYTE),
    ADDRESS_LINE_2 VARCHAR2(50 BYTE),
    ADDRESS_LINE_3 VARCHAR2(50 BYTE),
    ADDRESS_LINE_4 VARCHAR2(50 BYTE),
    ADDRESS_LINE_5 VARCHAR2(50 BYTE),
    POST_CODE VARCHAR2(12 BYTE),
    COUNTRY VARCHAR2(50 BYTE),
    OVERSEAS_ADDRESS_INDICATOR CHAR(1 BYTE),
    ORGANISATION_NAME VARCHAR2(50 BYTE),
    TPDB_PROCESSED_IDENTIFIER CHAR(2 BYTE),
    CLEANSING_STATUS VARCHAR2(30 BYTE),
    CATEGORY VARCHAR2(50 BYTE),
    SCHEME_NAME VARCHAR2(50 BYTE),
    STG_CREATE_DATE_TIME DATE,
    STG_UPDATE_DATE_TIME DATE,
    LAST_UPDATED_DATE_TIME DATE
    TABLESPACE TPDBS01A_DATA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 128K
    NEXT 128K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE UNIQUE INDEX TPD_STG_TL_SF_LEGAL_OWNER_PK ON TPD_STG_TL_SF_LEGAL_OWNER
    (THAMES_URN_WITH_ROLE_SUFFIX)
    LOGGING
    TABLESPACE TPDBS01A_DATA
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE (
    INITIAL 128K
    NEXT 128K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOPARALLEL;
    ALTER TABLE TPD_STG_TL_SF_LEGAL_OWNER ADD (
    CONSTRAINT TPD_STG_TL_SF_LEGAL_OWNER_PK
    PRIMARY KEY
    (THAMES_URN_WITH_ROLE_SUFFIX)
    USING INDEX
    TABLESPACE TPDBS01A_DATA
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE (
    INITIAL 128K
    NEXT 128K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    ));

    > If indexes don't help, is the only way to gain REAL
    performance gain on this type of query is to
    partition the table
    If a Full Table Scan on a table takes "too long" (and
    this is purely subjective - "too long" is different
    for every problem) and indexes can't help, and we
    need <100% of the rows, and if partitioning will give
    us the performance we desire, is it OK do it ? Also
    would STG_UPDATE_DATE_TIME be the best column to do a
    index partion ?
    For this type of query, partitioning on STG_UPDATE_DATE_TIME would be good.
    However, partitioning is not done just for one query. It has to fit in your total design. For example, if you are also doing queries with a predicate like <column with a local unique index but not the partition key> = <constant>, it would have to visit all partitions instead of just one, and those queries would take much longer to execute. You can make the index global, but there all kind of maintenance issues with that. In short: be careful about partitioning and think it through first.
    > But is it a good option to partition tables with
    total no. of rows between 2 million and 5 million ? I
    thought partitioning is better done for tables > 20
    million.
    Please throw some light on that.
    Generally, partitioning is done on bigger tables, yes. But it is not about some specific number of rows. You partition a table when all forecasted use of the table is known, so you can make a good judgement which usages will benefit, which ones won't be affected and which ones are likely to suffer. When the benefits outweigh the disadvantages, you partition...
    Above I had an example about queries that are going to suffer. Partitioning is beneficial for example when once in some period you'd have to delete A LOT of old rows. Or when you have some data warehousing queries that need like 10% of only the most recent data in a huge table.
    The decision is yours.
    Regards,
    Rob.

  • Select query in partition

    I created the partion by list table by using period column
    CREATE TABLE final_test(
    PRODNO VARCHAR2(20),
    PERIOD VARCHAR2(4),
    STATEMENT BLOB)
    PARTITION BY LIST(PERIOD)(PARTITION ST1007 VALUES('1007'), PARTITION
    STMST1107 VALUES('1107'), PARTITION ST1207 VALUES('1207'),PARTITION ST0108 VALUES('0108'))
    I inserted the records in below order.
    PRODNO PERIOD
    1001 0108
    1002 1107
    1003 1207
    1004 1007
    Now i want to display prodno,period colums in asc order of period.
    Is the below query is correct? OR we have to use order by clause in select st.
    select prodno,period from final_test where to_date(period,'mmrr') between to_Date('1007','mmrr')
    and TO_DATE(to_Char(SYSDATE, 'MMRR'), 'MMRR')
    pls suggest.

    to get the data retrived in perticular order, you have to use order by clause. here is the example, you have limited data,
    SQL> ed
    Wrote file afiedt.buf
      1  WITH final_test AS
      2    (SELECT '1001' PRODNO,'0108' PERIOD FROM dual
      3     UNION ALL
      4    SELECT[b] '1003' ,'1207'    FROM dual
      5     UNION ALL
      6    SELECT  '1002', '1107'     FROM dual
      7     UNION ALL
      8    SELECT  '1004' ,'1007'    FROM dual
      9     )
    10  SELECT prodno,period
    11  FROM final_test
    12  WHERE TO_DATE(period,'mmrr') BETWEEN TO_DATE('1007','mmrr')
    13*   AND TO_DATE(TO_CHAR(SYSDATE, 'MMRR'), 'MMRR')
    SQL> /
    PROD PERI
    1001 0108
    1003 1207
    1002 1107
    1004 1007
    SQL> ed
    Wrote file afiedt.buf
      1  WITH final_test AS
      2    (SELECT '1001' PRODNO,'0108' PERIOD FROM dual
      3     UNION ALL
      4    SELECT '1003' ,'1207'    FROM dual
      5     UNION ALL
      6    SELECT  '1002', '1107'     FROM dual
      7     UNION ALL
      8    SELECT  '1004' ,'1007'    FROM dual
      9     )
    10  SELECT prodno,period
    11  FROM final_test
    12  WHERE TO_DATE(period,'mmrr') BETWEEN TO_DATE('1007','mmrr')
    13    AND TO_DATE(TO_CHAR(SYSDATE, 'MMRR'), 'MMRR')
    14* ORDER BY PRODNO
    SQL> /
    PROD PERI
    1001 0108
    1002 1107
    1003 1207
    1004 1007
    SQL> ed
    Wrote file afiedt.buf
      1  WITH final_test AS
      2    (SELECT '1001' PRODNO,'0108' PERIOD FROM dual
      3     UNION ALL
      4    SELECT '1003' ,'1207'    FROM dual
      5     UNION ALL
      6    SELECT  '1002', '1107'     FROM dual
      7     UNION ALL
      8    SELECT  '1004' ,'1007'    FROM dual
      9     )
    10  SELECT prodno,period
    11  FROM final_test
    12  WHERE TO_DATE(period,'mmrr') BETWEEN TO_DATE('1007','mmrr')
    13    AND TO_DATE(TO_CHAR(SYSDATE, 'MMRR'), 'MMRR')
    14* ORDER BY  PRODNO descSQL> /
    PROD PERI
    1004 1007
    1003 1207
    1002 1107
    1001 0108
    SQL>

  • Please help with the query creating Materialized View

    Hi,
    We are using the below query to create a Materialized View but it has been running since 3 hours. It is an Oracle 9i database running in HP-UX.The quey is as follows,
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT'Intra-operative Misadventure'
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                   AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    --AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY=C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT='Reoperations'
                    --AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY>C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    The explain plan is as follows,
    PLAN_TABLE_OUTPUT
    | Id  | Operation                          |  Name                    | Rows  | Bytes |TempSpc| Cost  |  TQ    |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT                   |                          | 46935 |  6716K|       | 10648 |        |      |            |
    |   1 |  SORT UNIQUE                       |                          | 46935 |  6716K|    14M| 10648 | 45,14  | P->S | QC (RAND)  |
    |   2 |   UNION-ALL                        |                          |       |       |       |       | 45,13  | P->P | HASH       |
    |*  3 |    HASH JOIN                       |                          | 42801 |  6102K|       |  4640 | 45,13  | PCWP |            |
    |*  4 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   875 | 18375 |       |     2 | 45,02
    |*  5 |     HASH JOIN                      |                          | 41552 |  5072K|    14M|  4638 | 45,13  | PCWP |            |
    |*  6 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    40M|       |  2855 | 45,03
    |*  7 |      HASH JOIN                     |                          |   628K|    56M|       |   494 | 45,10  | P->P | HASH       |
    |*  8 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,08 
    |*  9 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2090K|    71M|       |   49
    |  10 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 11 |         BITMAP INDEX FULL SCAN     | INX_COMPL_GRP            |       |       |       |       |        |
    |* 12 |    TABLE ACCESS BY INDEX ROWID     | EES_CLINICAL_DATA        |     1 |    33 |       |     1
    |  13 |     NESTED LOOPS                   |                          |  1327 |   196K|       |   947 | 45,13  | PCWP |            |
    |* 14 |      HASH JOIN                     |                          | 60205 |  6996K|       |   495 | 45,13  | PCWP |            |
    |  15 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINCL_COMPL_ICD     |    36 |   756 |       |    
    |* 16 |        INDEX RANGE SCAN            | COMPL_TYPE_TXT_3         |     1 |       |       |     1 |     
    |* 17 |       HASH JOIN                    |                          |  1420K|   132M|       |   494 | 45,13  | PCWP |            |
    |* 18 |        TABLE ACCESS FULL           | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,11 
    |* 19 |        TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA  |  4722K|   175M|       |   49
    |  20 |         BITMAP CONVERSION TO ROWIDS|                          |       |       |       |       |        |      |           
    |  21 |          BITMAP INDEX FULL SCAN    | INX_COMPL_GRP            |       |       |       |       |        |
    |* 22 |      INDEX RANGE SCAN              | EES_CLINICAL_DATA_IND1   |     1 |       |       |     2 | 45,13
    |* 23 |    HASH JOIN                       |                          |  2807 |   416K|       |  4695 | 45,13  | PCWP |            |
    |  24 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   911 | 19131 |       |     2 | 45,06
    |* 25 |     HASH JOIN                      |                          |  2617 |   334K|    15M|  4693 | 45,13  | PCWP |            |
    |* 26 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    45M|       |  2855 | 45,07
    |* 27 |      HASH JOIN                     |                          |   791K|    74M|       |   305 | 45,12  | P->P | HASH       |
    |* 28 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,09 
    |* 29 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2632K|    97M|       |   30
    |  30 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 31 |         BITMAP INDEX SINGLE VALUE  | INX_COMPL_GRP            |       |       |       |       |        |
    Predicate Information (identified by operation id):
       3 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
       4 - filter("D"."COMPL_TYPE_TXT"'Intra-operative Misadventure')
       5 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
       6 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
       7 - access("A"."ICD_CODE"="B"."ICD_CODE")
       8 - filter("A"."SPECIALTY"='Colo-Rectal')
       9 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      11 - filter("B"."COMPL_GRP_TXT"'Reoperations')
      12 - filter("B"."ICD_CODE"="C"."ICD_CODE" AND "C"."PROC_TYPE"'L' AND "B"."PROC_DAY"="C"."PROC_DA
      14 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      16 - access("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
      17 - access("A"."ICD_CODE"="B"."ICD_CODE")
      18 - filter("A"."SPECIALTY"='Colo-Rectal')
      19 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      22 - access("B"."PAT_KEY"="C"."PAT_KEY")
      23 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      25 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
           filter("B"."PROC_DAY">"C"."PROC_DAY")
      26 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
      27 - access("A"."ICD_CODE"="B"."ICD_CODE")
      28 - filter("A"."SPECIALTY"='Colo-Rectal')
      29 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      31 - access("B"."COMPL_GRP_TXT"='Reoperations')
    Note: cpu costing is offPlease help.

    Try removing the hints.
    Is 47,000 a reasonable estimate of how many rows you expect in the results?
    See these posts for other information that you should supply.
    HOW TO: Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long
    When your query takes too long ...

  • Oracle 9i - PARTITION BY query not working

    hi,
    i have exceuted the query using PARTION BY using toad in oracle 9i database
    SELECT EMPS.ATD_CPR_NO emp_no_det,
    CALS.DAILY_DT entry_dt
    FROM
    (SELECT * FROM attd_time_data
    WHERE ATD_ENTRY_DT IS NOT NULL
    ) emps
    PARTITION BY (ATD_CPR_NO)
    RIGHT OUTER JOIN
    (SELECT * FROM ATTD_CALENDER_DT
    WHERE DAILY_DT IS NOT NULL
    ) CALS
    ON (CALS.DAILY_DT = EMPS.ATD_ENTRY_DT)
    its giving error " sql not properly ended"
    please provide solution
    Thanks,
    Maran

    Partition Outer Joins is the feature of Oracle 10g not 9i
    i think u r confuse with Analytical Functions Partition by thing.... Analytical functions are available since 8i
    Syntax for 10g Partition by
    SELECT ...
    FROM ...
    PARTITION BY (expr [,expr ]... )
    RIGHT OUTER JOIN table_referenceBaig
    [My Oracle Blog|http://baigsorcl.blogspot.com/]

  • Query tuning for data-warehousing application in Oracle 8i.

    We have to pick up 24 months old data. Each month data is kept in a different partition.
    2007-May month data is kept in PRESC200705 partition
    SELECT r.account_id,
    p.presc_num,
    spm.product_id,
    p.month,
    t.best_call_state,
    sum(p.trx_count)
    FROM rlup_assigned_account r,
    temp_presc_num_TEST t,
    retail.prescrip_retail partition (PRESC200705) p,
    sherlock.sherlock_product_mapping spm
    WHERE spm.product_id like '056%'
    and spm.mds6 = p.product_id
    and t.CLIENT_ID = p.presc_num
    and r.ndc_pyr_id = p.payer_plan
    and t.best_call_state = r.ST
    GROUP BY r.account_id,
    p.presc_num,
    spm.product_id,
    p.month,
    t.best_call_state
    Q This Query is to be tuned
    SQL> SELECT table_name,
    2 partition_name,
    3 high_value,
    4 num_rows
    5 FROM user_tab_partitions
    6 ;
    no rows selected

    I have the following task:
    Requirement:
    According to the client, new partitions are created every month.
    So the query should contain only the 24 most recent partions leaving one old partition every month.
    So, the query becomes dynamic.
    The query will have to leave one old partion every month and move ahead with the new partion created.
    The total partitions accessed should not cross 24.
    Is this possible?
    Partition# for OCt 2007
    1
    2
    3
    4
    5
    6
    7
    24
    Partition# for Nov 2007
    Old|New
    1
    2..1
    3..2
    4..3
    5..4
    6..5
    7..6
    24..23
    ..24
    Secondly, with one month data (in a partitioned table), the query takes about one hour to run.
    with 24 month data accessed by the query, the query will take 24 hours to run.
    I am sure that Oracle can be tuned to run on such huge data with ease and the query output can
    come within seconds.. Otherwise, nobody would use oracle for datawarehousing applicaions.
    Q. How do I write a dynamic query that references 24 recent partitions, using the query provided:
    abc>SELECT r.account_id,
    2 p.presc_num,
    3 spm.product_id,
    4 p.month,
    5 t.best_call_state,
    6 sum(p.trx_count)
    7 FROM rlup_assigned_account r,
    8 temp_presc_num_TEST t,
    9 retail.prescrip_retail partition (PRESC200705) p,
    10 sherlock.sherlock_product_mapping spm
    11 WHERE spm.product_id like '056%'
    12 and t.CLIENT_ID='934759'
    13 and spm.mds6 = p.product_id
    14 and t.CLIENT_ID = p.presc_num
    15 and r.ndc_pyr_id = p.payer_plan
    16 and t.best_call_state = r.ST
    17 GROUP BY r.account_id,
    18 p.presc_num,
    19 spm.product_id,
    20 p.month,
    21 t.best_call_state
    22 ;
    retail.prescrip_retail partition (PRESC200705) p,
    Partition name, PRESC200705 cannot be hardcoded into the sql.
    Sql should take a range of 24 recent partitions.
    And the query should execute fast too.
    Now, is that what is called a challenge?
    +++++++++++++++++++++++++++++++++++++++++++++++
    Here are the index/constraints/explain_plan output on prescrip_retail table (which is partitioned)
    as well as other tables to which prescrip_retail table is joined
    This is what prescrip_retail looks like. This is the table having partitions.
    It does not seem to have a primary key!
    SQL> desc prescrip_retail
    Name Null? Type
    PRESC_NUM NUMBER
    PFIER_NUM CHAR(8)
    RELID NOT NULL CHAR(9)
    ME_NUM NOT NULL CHAR(10)
    PRODUCT_ID NOT NULL CHAR(6)
    PRODUCT_FRMSTR NOT NULL CHAR(1)
    PAYER_PLAN NOT NULL CHAR(6)
    MONTH NOT NULL DATE
    PYMT_CODE NOT NULL CHAR(1)
    NRX_COUNT NOT NULL NUMBER(7)
    NRX_QUANTITY NOT NULL NUMBER(9)
    NRX_DOLLARS NOT NULL NUMBER(13,2)
    TRX_COUNT NOT NULL NUMBER(7)
    TRX_QUANTITY NOT NULL NUMBER(9)
    TRX_DOLLARS NOT NULL NUMBER(13,2)
    Table Size of Prescrip_Retail...
    1 select table_name,tablespace_name,pct_free,pct_used,num_rows,avg_space
    2 from all_tables
    3* where table_name='PRESCRIP_RETAIL'
    SQL> /
    TABLE_NAME TABLESPACE_NAME PCT_FREE PCT_USED NUM_ROWS AVG_SPACE
    PRESCRIP_RETAIL 2806673860 360
    Explain Plan for the query to be tuned...
    22:32:31 SQL> explain plan set statement_id='vista_query'
    22:43:33 2 for
    22:43:35 3 SELECT r.pfier_account_id,
    22:43:41 4 p.presc_num,
    22:43:41 5 spm.product_id,
    22:43:41 6 p.month,
    22:43:41 7 t.best_call_state,
    22:43:41 8 sum(p.trx_count)
    22:43:41 9 FROM rlup_assigned_account r,
    22:43:41 10 temp_presc_num_TEST t,
    22:43:41 11 retail.prescrip_retail partition (PRESC200705) p,
    22:43:41 12 sherlock.sherlock_product_mapping spm
    22:43:41 13 WHERE spm.product_id like '056%'
    22:43:41 14 and spm.mds6 = p.product_id
    22:43:41 15 and t.CLIENT_ID = p.presc_num
    22:43:41 16 and r.ndc_pyr_id = p.payer_plan
    22:43:41 17 and t.best_call_state = r.ST
    22:43:41 18 GROUP BY r.pfier_account_id,
    22:43:41 19 p.presc_num,
    22:43:41 20 spm.product_id,
    22:43:41 21 p.month,
    22:43:41 22 t.best_call_state;
    Explained.
    SQL> select statement_id,operation,options,object_name
    2 from plan_table
    3 where statement_id='vista_query';
    22:46:03 SQL> /
    STATEMENT_ID OPERATION OPTIONS OBJECT_NAME
    vista_query SELECT STATEMENT
    vista_query SORT GROUP BY
    vista_query HASH JOIN
    vista_query TABLE ACCESS FULL TEMP_PRESC_NUM_TEST
    vista_query HASH JOIN
    vista_query TABLE ACCESS FULL RLUP_ASSIGNED_ACCOUNT
    vista_query HASH JOIN
    vista_query TABLE ACCESS FULL SHERLOCK_PRODUCT_MAPPING
    vista_query TABLE ACCESS FULL PRESCRIP_RETAIL
    9 rows selected.
    Partition Pruning: This is supposed to provide an insight to the partitions oracle
    vists internally...
    I guess we can use "month>= add_months(sysdate,-24)" instead of partions too.
    I don't think Oracle is visiting any partitions.
    I'll also search into all_tab_partitions to verify this.
    Explain_Plan for what partitions oracle visits internally (partition pruning):
    SQL> ed
    Wrote file afiedt.buf
    1 explain plan set statement_id='vista'
    2 for select * from retail.prescrip_retail
    3* where month>= add_months(sysdate,-24)
    SQL> /
    Explained.
    Elapsed: 00:00:00.05
    22:13:56 SQL> select statement_id,operation,options,object_name
    22:14:28 2 from plan_table
    22:14:30 3 where statement_id='vista';
    STATEMENT_ID OPERATION
    OPTIONS OBJECT_NAME
    vista SELECT STATEMENT
    vista PARTITION RANGE
    ITERATOR
    vista TABLE ACCESS
    FULL PRESCRIP_RETAIL
    Elapsed: 00:00:01.00
    Indexes/Constraints on PRESCRIP_RETAIL table:
    SQL> ED
    Wrote file afiedt.buf
    1 SELECT TABLE_NAME,TABLE_TYPE,INDEX_NAME,INDEX_TYPE,PCT_FREE,STATUS,PARTITIONED
    2 FROM ALL_INDEXES
    3* WHERE TABLE_NAME IN ('PRESCRIP_RETAIL')
    SQL> /
    TABLE_NAME TABLE INDEX_NAME INDEX_TYPE PCT_FREE STATUS PAR
    PRESCRIP_RETAIL TABLE BX6_PRESC_RELID BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX7_PRESC_ME BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX1_PRESC_PROD BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX2_PRESC_PAYER BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX3_PRESC_PAYERCD BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX4_PRESC_PRESC BITMAP N/A YES
    PRESCRIP_RETAIL TABLE BX5_PRESC_PFIER BITMAP N/A YES
    7 rows selected.
    SQL> ed
    Wrote file afiedt.buf
    1 SELECT TABLE_NAME,CONSTRAINT_NAME,CONSTRAINT_TYPE,STATUS,DEFERRABLE
    2 FROM ALL_CONSTRAINTS
    3* WHERE TABLE_NAME IN ('PRESCRIP_RETAIL')
    SQL> /
    TABLE_NAME CONSTRAINT_NAME C STATUS DEFERRABLE
    PRESCRIP_RETAIL SYS_C001219 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001220 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001221 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001222 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001223 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001224 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001225 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001226 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001227 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001228 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001229 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001230 C ENABLED NOT DEFERRABLE
    PRESCRIP_RETAIL SYS_C001231 C ENABLED NOT DEFERRABLE
    13 rows selected.
    In all_tables:
    NUM_ROWS:2806673860
    AVG_SPACE:360
    Here is the data size in the table.
    SQL> select count(*) from PRESCRIP_RETAIL;
    COUNT(*)
    4602980312
    Again, here is the partition information and the amount of data in each partition:
    SQL> ed
    Wrote file afiedt.buf
    1 select
    2 partition_name,SUBPARTITION_COUNT,PARTITION_POSITION,TABLESPACE_NAME,
    3 NUM_ROWS
    4 from all_tab_partitions
    5 where table_name='PRESCRIP_RETAIL'
    6* order by partition_name desc
    SQL> /
    PARTITION_NAME SUBPARTITION_COUNT PARTITION_POSITION TABLESPACE_NAME NUM_ROWS
    PRESC200705 0 36 PRESC_PARTITION_29 141147085
    PRESC200704 0 35 PRESC_PARTITION_28 140299317
    PRESC200703 0 34 PRESC_PARTITION_27 140703128
    PRESC200702 0 33 PRESC_PARTITION_26 132592733
    PRESC200701 0 32 PRESC_PARTITION_25 145832356
    PRESC200612 0 31 PRESC_PARTITION_24 136702837
    PRESC200611 0 30 PRESC_PARTITION_23 137421767
    PRESC200610 0 29 PRESC_PARTITION_22 140836119
    PRESC200609 0 28 PRESC_PARTITION_21 131273578
    PRESC200608 0 27 PRESC_PARTITION_20 134967317
    PRESC200607 0 26 PRESC_PARTITION_19 130785504
    PRESC200606 0 25 PRESC_PARTITION_18 131472696
    PRESC200605 0 24 PRESC_PARTITION_17 138590581
    PRESC200604 0 23 PRESC_PARTITION_16 126849798
    PRESC200603 0 22 PRESC_PARTITION_15 137164667
    PRESC200602 0 21 PRESC_PARTITION_14 126938544
    PRESC200601 0 20 PRESC_PARTITION_13 135408324
    PRESC200512 0 19 PRESC_PARTITION_12 123285100
    PRESC200511 0 18 PRESC_PARTITION_11 121245764
    PRESC200510 0 17 PRESC_PARTITION_10 122112932
    PRESC200509 0 16 PRESC_PARTITION_09 119137399
    PRESC200508 0 15 PRESC_PARTITION_08 123372311
    PRESC200507 0 14 PRESC_PARTITION_07 112905435
    PRESC200506 0 13 PRESC_PARTITION_06 119581406
    PRESC200505 0 12 PRESC_PARTITION_05 123977315
    PRESC200504 0 11 PRESC_PARTITION_04 118975597
    PRESC200503 0 10 PRESC_PARTITION_03 125782688
    PRESC200502 0 9 PRESC_PARTITION_02 117448839
    PRESC200501 0 8 PRESC_PARTITION_01 122214436
    PRESC200412 0 7 PRESC_PARTITION_36 124799998
    PRESC200411 0 6 PRESC_PARTITION_35 125471042
    PRESC200410 0 5 PRESC_PARTITION_34 118457422
    PRESC200409 0 4 PRESC_PARTITION_33 119537488
    PRESC200408 0 3 PRESC_PARTITION_32 121319137
    PRESC200407 0 2 PRESC_PARTITION_31 115226621
    PRESC200406 0 1 PRESC_PARTITION_30 119143031
    36 rows selected.
    Data in induvidual partition of PRESCRIP_RETAIL.
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200704);
    COUNT(*)
    140299317
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200703);
    COUNT(*)
    140703128
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200702);
    COUNT(*)
    132592733
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200701);
    COUNT(*)
    145832356
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200606);
    COUNT(*)
    131472696
    SQL> SELECT COUNT(*) FROM PRESCRIP_RETAIL PARTITION(PRESC200605);
    COUNT(*)
    138590581
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Other tables info:
    Index of other tables related to PRESCRIP_REATIL:
    SQL> SELECT TABLE_NAME,TABLE_TYPE,INDEX_NAME,INDEX_TYPE,PCT_FREE,STATUS,PARTITIONED
    2 FROM ALL_INDEXES
    3 WHERE TABLE_NAME IN ('RLUP_ASSIGNED_ACCOUNT','TEMP_PRESC_NUM_TEST','SHERLOCK_PRODUCT_MAPPING');
    SQL> /
    TABLE_NAME TABLE INDEX_NAME INDEX_TYPE PCT_FREE STATUS PAR
    SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_PK NORMAL 10 VALID NO
    SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_X1 NORMAL 0 VALID NO
    SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX1 BITMAP 0 VALID NO
    SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX2 BITMAP 0 VALID NO
    SHERLOCK_PRODUCT_MAPPING TABLE SHERLOCK_PRODUCT_MAPPING_BX3 BITMAP 0 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX1_RLUP_ASSIGNED_ACCT_PYR BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX2_RLUP_ASSIGNED_ACCT_TOPLVL BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX3_RLUP_ASSIGNED_ACCT_PBM BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX4_RLUP_ASSIGNED_ACCT_AA_FLAG BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX5_RLUP_ASSIGNED_ACCT_AA_CHD BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX6_RLUP_ASSIGNED_ACCT_PBM_FLG BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE BX7_RLUP_ASSIGNED_ACCT_ACCTID BITMAP 10 VALID NO
    RLUP_ASSIGNED_ACCOUNT TABLE PK_RLUP_ASSIGNED_ACCOUNT NORMAL 10 VALID NO
    13 rows selected.
    Constraints in other tables:
    SQL> SELECT TABLE_NAME,CONSTRAINT_NAME,CONSTRAINT_TYPE,STATUS,DEFERRABLE
    2 FROM ALL_CONSTRAINTS
    3 WHERE TABLE_NAME IN ('RLUP_ASSIGNED_ACCOUNT','TEMP_PRESC_NUM_TEST','SHERLOCK_PRODUCT_MAPPING');
    TABLE_NAME CONSTRAINT_NAME C STATUS DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637753 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637754 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637755 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637756 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637757 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637758 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637759 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637760 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637761 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT SYS_C00637762 C ENABLED NOT DEFERRABLE
    RLUP_ASSIGNED_ACCOUNT PK_RLUP_ASSIGNED_ACCOUNT P ENABLED NOT DEFERRABLE
    TEMP_PRESC_NUM_TEST SYS_C00640536 C ENABLED NOT DEFERRABLE
    12 rows selected.
    TEMP_PRESC_NUM_TEST does not contain any constraints or index.

  • Object_id's differs in table partions in oracle 10g.

    Can you please see the below and suggest me if this is acceptable result set.. how come object ids differs in data dictionary table from actual object ids. How do I ensure that the following query returns rows after moving partitions one table space to another.
    select t.* , u.object_name, u.subobject_name from user1.t t, all_objects u where dbms_rowid.rowid_object(t.rowid)=u.object_id
    DB version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    work:
    SQL> CREATE TABLE t
    2 (
    3 a date,
    4 b int,
    5 c varchar2(15)
    6 )
    7 PARTITION BY RANGE (a)
    8 (
    9 PARTITION p1
    10 VALUES LESS THAN
    11 (to_date('01-jan-2009',
    12 'dd-mon-yyyy'))
    13 tablespace rw,
    14 PARTITION p2
    15 VALUES LESS THAN
    16 (to_date('01-jan-2010',
    17 'dd-mon-yyyy'))
    18 tablespace ro
    19 );
    SQL> insert into t (a,b,c)
    2 values
    3 (to_date('01-jun-2008',
    4 'dd-mon-yyyy'),
    5 1, 'hello' );
    1 row created.
    SQL> insert into t (a,b,c)
    2 values
    3 (to_date('01-jun-2009',
    4 'dd-mon-yyyy'),
    5 1, 'Bye' );
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * From user1.t;
    A B C
    01-JUN-08 1 hello
    01-JUN-09 1 Bye
    2 rows selected.
    SQL> select t.* , u.object_name, u.subobject_name from user1.t t, all_objects u where dbms_rowid.rowid_object(t.rowid)=u.object_id;
    A B C OBJECT_NAME SUBOBJECT_NAME
    01-JUN-08 1 hello T P1
    01-JUN-09 1 Bye T P2
    2 rows selected.
    SQL> alter table user1.t move partition p1 tablespace rw1;
    Table altered.
    SQL> select t.* , u.object_name, u.subobject_name from user1.t t, all_objects u where dbms_rowid.rowid_object(t.rowid)=u.object_id;
    A B C OBJECT_NAME SUBOBJECT_NAME
    01-JUN-09 1 Bye T P2
    1 row selected.
    SQL> alter table user1.t move partition p2 tablespace rw;
    Table altered.
    SQL> select t.* , u.object_name, u.subobject_name from user1.t t, all_objects u where dbms_rowid.rowid_object(t.rowid)=u.object_id;
    no rows selected
    SQL> select * From user1.t;
    A B C
    01-JUN-08 1 hello
    01-JUN-09 1 Bye
    2 rows selected.
    SQL> SELECT OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID FROM USER_OBJECTS;
    OBJECT_NAME SUBOBJECT_NAME OBJECT_ID
    T P2 54578
    T P1 54577
    T 54576
    3 rows selected.
    SQL> select dbms_rowid.rowid_object(t.rowid), t.* from user1.t;
    DBMS_ROWID.ROWID_OBJECT(T.ROWID) A B C
    54579 01-JUN-08 1 hello
    54580 01-JUN-09 1 Bye
    2 rows selected.
    SQL> execute dbms_Stats.gather_schema_Stats('USER1');
    PL/SQL procedure successfully completed.
    SQL> SELECT OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID FROM USER_OBJECTS;
    OBJECT_NAME SUBOBJECT_NAME OBJECT_ID
    T P2 54578
    T P1 54577
    T 54576
    3 rows selected.
    SQL> EXECUTE DBMS_sTATS.GATHER_TABLE_sTATS('USER1','T');
    PL/SQL procedure successfully completed.
    SQL> SELECT OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID FROM USER_OBJECTS;
    OBJECT_NAME SUBOBJECT_NAME OBJECT_ID
    T P2 54578
    T P1 54577
    T 54576
    3 rows selected.
    SQL> ANALYZE TABLE USER1.T COMPUTE STATISTICS;
    Table analyzed.
    SQL> SELECT OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID FROM USER_OBJECTS;
    OBJECT_NAME SUBOBJECT_NAME OBJECT_ID
    T P2 54578
    T P1 54577
    T 54576
    SQL> select t.* , u.object_name, u.subobject_name from user1.t t, all_objects u where dbms_rowid.rowid_object(t.rowid)=u.object_id;
    no rows selected
    Can one guide me or suggest me if this is acceptable or anything look into?

    Thank you all..
    Okay, what query i should write to know which rows are existed in which partion? I do not want to select entire partition records with sql but based on rows of interest.
    Suppose I have a 100 rows which are stored among various partitions and I want list of those rows along with partitions that the rows are stored in with SQL statement. ?
    can u please provide SQL statement? Thanks in advance..

  • How to sppedup performance of a query

    Hi,
    I am running query on a partion table its taking too much of time in stage database.
    where as same query is taking very less time in prod.
    table stats are nt stale..indexes are same as prod and data is also same as prod.Still query is taking much time on stage database.
    Any suggestions to tune query.
    Any work around
    Thanks.

    What about the explain plan from prod to stage database?
    Please check the following thread:
    When your query takes too long ..
    When your query takes too long ...
    HTH
    -Anantha

  • Lingering query cannot process

    Hi, I need some help tracking the reason behind the lingering of a Create Table as Select STATEMENT;
    Something is hapening, most probably some locks have been aquired and never released by the server.
    First of, i am runing queries against a database server with one client: myself. All the queries it runs are ordered by me.
    I cannot make any sense of what is making my query sometimes run, and others not.
    The query I am trying to run:
    CREATE TABLE FAVFRIEND
    NOLOGGING TABLESPACE TARGET
    AS
    SELECT USRID, FAVF
    FROM (
         SELECT ID AS USRID, FAVF
         FROM PROFILE P
         MODEL
              PARTITION BY (ID)
              DIMENSION BY (1 as FINDEX)
              MEASURES (FAVF1, FAVF2, FAVF3, FAVF4, FAVF5, 0 AS FAVF)
              RULES (
                   FAVF[1] = FAVF1[1],
                   FAVF[2] = FAVF2[1],
                   FAVF[3] = FAVF3[1],
                   FAVF[4] = FAVF4[1],
                   FAVF[5] = FAVF5[1]
         ) FAVFRIEND
    WHERE FAVF IS NOT NULL
    The query Is syntatically correct, and has finished more than once.
    Before this query is run my program launches sqlplus with a script that performs
    DROP TABLE FAVFRIEND PURGE;
    QUIT;
    After this I snapshot a set of statistics. That do not involve querying neither the PROFILE table, nor the FAVFRIEND table.
    Finally I order the execution of this query, and most times, it just hangs there not doing any processing.
    I can tell with certanty that all the other sql I have sent to the database has finished execution.
    1) because it was processed via sqlplus, which always disconnects after processing a batch.
    2) because I run the following query:
    select s.username,s.sid,s.serial#,s.last_call_et/60 mins_running,q.sql_text
    from v$session s join v$sqltext_with_newlines q on s.sql_address = q.address
    where status='ACTIVE'
    and s.username = 'SONO99'
    and type <>'BACKGROUND'
    and last_call_et> 0
    order by sid,serial#,q.piece
    Which tells me that the only query sono99 (my user) is running, is the CREATE TABLE as SELECT.
    Furthermore, the exact same procedure that isn't working for this query has worked before with the Unpivot query and the Select Project and Union queries.
    The only thing that changed from the previous benchmakrs to this one is that this one involves the model query.
    Another piece of information, let's say my sqlplus is haning there... trying to execute the Model query that just does not run. I kill sqlplus. Instantly when i query Oracle for the lingering queries with the select from v%session and sql_text, I notice that my CREATE TABLE with model is no longer there. So: disconnecting from the database is enough for oracle to know that the client is no longer interested in a server response.
    After making sure nothing from sono99 is runing against the database, i try to DROP FAVFRIEND TABLE PURGE;
    The statement fails because no FAVFRIEND table was created. And finally i wonder: could it be that the PROFILE table that was only selected upon was locked?
    Well, i try to drop the profile table... and it drops.
    So: my conclusion is! No locks exist neither on the Profile table nor on the Database object Favfriend (which does not exist at the point that i issue the execution of this query). Possibly some temporary tablespace was aquired by the Model query that has not been made available by oracle at the End of a previous successful CRETE TABLE as select statement.
    But even if this was the case, any locks should have been released because I always restart the database before going into the
    snapshot
    create table as select
    snapshot.
    I have no idea what may be making oracle not process my statement.
    Something else that I have just tried:
    Now I just tried bulk loading the 5 million rows of data into the Profile table, and runing the query again.
    The data was of course inserted successfully, and the query is of course still hanging.
    I tried however, in parallel to run a second query, this one just performing a SELECT count(*) FROM PROFILE, and it succeeded doing so.
    A Select NAME FROM PROFILE WHERE ID=500000 also returns a result.
    The profile table is definably not the issue here.
    by the way i just exported to a txt the status of my haning oracle system, and it looks like this:
    "USERNAME"     "SID"     "SERIAL#"     "MINS_RUNNING"     "SQL_TEXT"
    "SONO99"     "140"     "40"     "10,9"     "CREATE TABLE FAVFRIEND
    NOLOGGING TABLESPACE TARGET
    AS
    SELECT USR"
    "SONO99"     "140"     "40"     "10,9"     "ID, FAVF
    FROM (
         SELECT ID AS USRID, FAVF
         FROM PROFILE P
         MODEL"
    "SONO99"     "140"     "40"     "10,9"     "
              PARTITION BY (ID)
              DIMENSION BY (1 as FINDEX)
              MEASURES (FA"
    "SONO99"     "140"     "40"     "10,9"     "VF1, FAVF2, FAVF3, FAVF4, FAVF5, 0 AS FAVF)
              RULES (
                   FAVF[1]"
    "SONO99"     "140"     "40"     "10,9"     " = FAVF1[1],
                   FAVF[2] = FAVF2[1],
                   FAVF[3] = FAVF3[1],
                   FA"
    "SONO99"     "140"     "40"     "10,9"     "VF[4] = FAVF4[1],
                   FAVF[5] = FAVF5[1]
         ) FAVFRIEND
    WHERE F"
    "SONO99"     "140"     "40"     "10,9"     "AVF IS NOT NULL
    This is way beyond my comprehention of Oracle. Going to try to run this again with 100 k tuples instead.
    Edited by: user10282047 on Oct 20, 2009 12:05 PM
    Now, trying the same process, without even restarting the database once (i just killed the lingering sqlplus connection) and recreated the profile table with 100k tuples. It executed successfuly my query. I am starting to think that this problem has something to with oracle and the number of threads it tries to created to run a modal query with 5 Million partitions. But if it is so, it shouldn't work sometimes and others not.
    Edited by: user10282047 on Oct 20, 2009 12:23 PM

    This definably looks like an oracle bug!
    Throughout the night the computer ran several tests against the database with source tables containing less than 5 million tupels and it succeeded in processing them.
    The 5 million tuple query has like 1 in 100 chances of succeeding.
    I thought about chaning the query implementation and eleminating the Partion By (ID),
    but unfortantly the CV(ID) function can only be used on the right side of a rule.
    I cannot right a rule like FAVF(cv(ID), 1) = FAVF1(CV(ID),1),
    and so. While the first CV works the last doesn't.
    Just finished trying this query with 3 million tuples, and It also worked.
    I am gonna quit trying to find out a problem on my behalf, this clearly on Oracle's hands not mine.
    There is some breaking point where the model query stops working.
    Currently i think that it may be related with the Partition By clause, Oracle may not be prepared to handle that many partitions. Unfortunately I can not process the query with just one partiton (that being the whole database table, because they don't allow me to use the CV function on the left side of a rule).
    So I will consider the operator tested.
    Edited by: sono99 on Oct 21, 2009 8:27 AM

  • Oracle 9.2.0.6; query hangs if partition doesn't exist

    Hallo all,
    this is the first time I post on this forum.
    I work in a group of PL\SQL developers in Italy. Few day ago we had a problem with a query and like to find out what the problem is.
    We have an Oracle DB version 9.2.0.6 (old I know) in a production environment. Linux OS.
    The query was made to extract data from a partitined table, on a partioned field, in our casa one Year. By mistake we have serced for the wrong year, 2013. There where no data for that year and therefor no partition.
    So, happened that the query hangs and after 24 hours was terminated.
    What we expected indeed was a zero records retirned in, at the most, few minutes, see that the table, in severa partition contains about 16 million records.
    The we tested the same query but in a different enviroment, Oracle 11gr2, same table structure, same partitioning, without partition 2013, and the query completed in less tha 1 minute with zero records in output.
    At this point we thought of a bug, but can't find any reference.
    Has anyone had a similar experience or can give some indication of possible bug report.
    Thanks for any help.

    Hi Rob,
    thank you for your answer.
    Sorry if this is not the best forum. I am not very practical.
    I try to answer to your questions.
    At a first time we thought the query did a full scan on the table. Yes. But even to full scan 16.000.000 records split in no more than 8 partition (at this time) shouldn't take up to 24 hours and never stop running. I think.
    We don't have a DBA role so we do not have full control over what is running. And take too long time to open a ticket and ask the DBA to check.
    What we did is testing the same query in a pre-prod environment, which is an Oracle 11gr2.
    I understand that it is not very usual to have a pre-production environment with a latest version of oracle but this is the way we have to work.
    Anyway, the test in pre-production worked very well. Without 2013 partition the return was very fast and we had zero records as expected.
    Then we found a workaround for production, ora 9. Call it work around maybe is too much ........
    We created the 2013 partition and run the query. The respons was then succesfull in about the same time than in pre-prod. Less than one minute and zero records.
    And this is fine for us.
    What we don't understand is why this different behavior with two different version of DB. Thats why we think it is due to a bug. We only want to find out whether it is this or if there is a different reason.
    Some other response or help would help.
    Thank you.

  • Aggregate Query Problem

    I have a partioned table containing 2002 data with the following format:
    TAGNAME NOT NULL VARCHAR2(15)
    DATA_TYPE NOT NULL CHAR(1)
    DATA_DATE NOT NULL DATE
    QUALITY CHAR(1)
    AVERAGE NUMBER(22,6)
    MINIMUM NUMBER(22,6)
    MINTIME DATE
    MAXIMUM NUMBER(22,6)
    MAXTIME DATE
    TOTAL NUMBER(22,6)
    MINUTES_ON NUMBER(11)
    MINUTES_OFF NUMBER(11)
    MOTOR_STARTS NUMBER(11)
    MOTOR_STOPS NUMBER(11)
    CERTIFIED CHAR(1)
    I need to build a query that will bring back the max(total) and min(total) and the dates they occurred for month-to-date and year-to-date. I have tried including the value in a subquery, but it fails on "group function not allowed here." I also need to keep the date to one returned value in the event that more than one date exists with the min/max value.
    An example of one I tried just getting the min value and date returned for the year (the partition):
    SELECT min(sd.total) as "Minimum",
    (SELECT data_date
    FROM sd_table
    WHERE total = min(sd.total)
    and tagname = sd.tagname
    and rownum = 1) as "MaxDate"
    FROM sd_table sd
    SQL> /
    (SELECT data_date FROM sh_table WHERE total = min(a.total)
    ERROR at line 2:
    ORA-00934: group function is not allowed here
    Any suggestions??
    Thanks.

    Correction:
    The examples that I gave above would have been for the last year or 365 days and the last month or 30 days. The following corrected version is for the current year and the current month up until today's date, which is what I think you mean by year-to-date and month-to-date.
    scott@ORA92> -- test data
    scott@ORA92> SELECT total, data_date FROM sd_table
      2  /
         TOTAL DATA_DATE
             3 03-APR-04
            20 24-APR-04
             1 24-APR-04
             3 02-APR-04
             4 01-APR-04
             2 03-FEB-04
            10 24-JAN-04
    7 rows selected.
    scott@ORA92> COLUMN min_or_max FORMAT A10
    scott@ORA92> SELECT 'Year-to-date' AS period,
      2           'Minimum'        AS min_or_max,
      3           total,
      4           data_date
      5  FROM   (SELECT total, data_date,
      6                ROW_NUMBER () OVER (ORDER BY total ASC, data_date DESC) AS rk
      7            FROM   sd_table
      8            WHERE  data_date BETWEEN TRUNC (SYSDATE, 'YYYY') AND SYSDATE)
      9  WHERE  rk = 1
    10  UNION ALL
    11  SELECT 'Month-to-date' AS period,
    12           'Minimum'         AS min_or_max,
    13           total,
    14           data_date
    15  FROM   (SELECT total, data_date,
    16                ROW_NUMBER () OVER (ORDER BY total ASC, data_date DESC) AS rk
    17            FROM   sd_table
    18            WHERE  data_date BETWEEN TRUNC (SYSDATE, 'MM') AND SYSDATE)
    19  WHERE  rk = 1
    20  UNION ALL
    21  SELECT 'Year-to-date' AS period,
    22           'Maximum'        AS min_or_max,
    23           total,
    24           data_date
    25  FROM   (SELECT total, data_date,
    26                ROW_NUMBER () OVER (ORDER BY total DESC, data_date DESC) AS rk
    27            FROM   sd_table
    28            WHERE  data_date BETWEEN TRUNC (SYSDATE, 'YYYY') AND SYSDATE)
    29  WHERE  rk = 1
    30  UNION ALL
    31  SELECT 'Month-to-date' AS period,
    32           'Maximum'         AS min_or_max,
    33           total,
    34           data_date
    35  FROM   (SELECT total, data_date,
    36                ROW_NUMBER () OVER (ORDER BY total DESC, data_date DESC) AS rk
    37            FROM   sd_table
    38            WHERE  data_date BETWEEN TRUNC (SYSDATE, 'MM') AND SYSDATE)
    39  WHERE  rk = 1
    40  /
    PERIOD        MIN_OR_MAX      TOTAL DATA_DATE
    Year-to-date  Minimum             2 03-FEB-04
    Month-to-date Minimum             3 03-APR-04
    Year-to-date  Maximum            10 24-JAN-04
    Month-to-date Maximum             4 01-APR-04
    scott@ORA92> SELECT year_min.total     AS ytd_min,
      2           year_min.data_date AS y_mindate,
      3           mon_min.total      AS mtd_min,
      4           mon_min.data_date  AS m_mindate,
      5           year_max.total     AS ytd_max,
      6           year_max.data_date AS y_maxdate,
      7           mon_max.total      AS mtd_max,
      8           mon_max.data_date  AS m_maxdate
      9  FROM   (SELECT total, data_date
    10            FROM   (SELECT total, data_date,
    11                     ROW_NUMBER () OVER (ORDER BY total ASC, data_date DESC) AS rk
    12                 FROM   sd_table
    13                 WHERE  data_date BETWEEN TRUNC (SYSDATE, 'YYYY') AND SYSDATE)
    14            WHERE  rk = 1) year_min,
    15           (SELECT total, data_date
    16            FROM   (SELECT total, data_date,
    17                     ROW_NUMBER () OVER (ORDER BY total ASC, data_date DESC) AS rk
    18                 FROM   sd_table
    19                 WHERE  data_date BETWEEN TRUNC (SYSDATE, 'MM') AND SYSDATE)
    20            WHERE  rk = 1) mon_min,
    21           (SELECT total, data_date
    22            FROM   (SELECT total, data_date,
    23                     ROW_NUMBER () OVER (ORDER BY total DESC, data_date DESC) AS rk
    24                 FROM   sd_table
    25                 WHERE  data_date BETWEEN TRUNC (SYSDATE, 'YYYY') AND SYSDATE)
    26            WHERE  rk = 1) year_max,
    27           (SELECT total, data_date
    28            FROM   (SELECT total, data_date,
    29                     ROW_NUMBER () OVER (ORDER BY total DESC, data_date DESC) AS rk
    30                 FROM   sd_table
    31                 WHERE  data_date BETWEEN TRUNC (SYSDATE, 'MM') AND SYSDATE)
    32            WHERE  rk = 1) mon_max
    33  /
       YTD_MIN Y_MINDATE    MTD_MIN M_MINDATE    YTD_MAX Y_MAXDATE    MTD_MAX M_MAXDATE
             2 03-FEB-04          3 03-APR-04         10 24-JAN-04          4 01-APR-04

Maybe you are looking for

  • Session time out in ADF 11g application.

    Hi, I am working for the ST BPO Project. We have one ADF application that is migrated from 10g to 11g.And our application is deployed on the weblogic server. we are facing some session time out issues in the application which is intermittent and when

  • SQL Sever Management Studio intellisense issue in SQL Server 2008 R2 and in SQL Sever 2012

    Hi Team, Intellisense in sql server management studio is working fine when i am accessing the databases in my  local server. But Intellisense is not working when ever i am trying to connect to the remote servers with the client I tried different blog

  • System Settings Add-On Installer on KDE4.9 [Solved/Disregard]

    Hey everyone! I've been having this problem for days now and I can't figure out what to do. So, here's the problem, I have a working internet connection and everything, however, if I want to go and get a new window decoration the Add-On Installer nev

  • After new OS Update system runs extra slow!

    After OS Update to lates OS, runs super slow. I have tried every tip in the book and it is running extra slow.

  • Expert Help needed with Sql Loader !

    Hello Friends...I am using one .dat file that contains several values in a particular column and I need to load those values in different tables with sqlloader.....For example: in column 3 there are values 0001, 0004, 0007, 9999 ..> values 0001 and 0