TooManyObjectsException on Select with Where

i'm using ADF and JSF in Oracle JDeveloper Studio Edition (10.1.3.0.4) with SU5
the project I'm working on, we need to filter on week numbers and usernames, both represented as a string throughout the application. currently we are doing this by defining those 2 parameters in a JSP page in inputtext fields which are bound to a backing bean.
when i press a button, a method is triggered that reads those coreInputText fields in that same backing bean and defines the where clause on the necessary view object. this query runs fine (i took it out of the running log and executed in the database web interface) and most of the time it even runs fine within the page as well.
in fact, it works as long as i leave the filled in filter variables the way they are by default, but when i choose to alter that param it throws a TooManyObjectsException. even tho (as i said) the query runs fine outside the application.
the method applying the filter is within the automatically bound backing bean connected to the JSP page, calling a pageForward which returns to the page it came from.
I'm running out of possible causes for this exception. for the keys are fine as far as i can see. the query itself is good. it does work every 1st attempt (calling a vo.clearCache(); has no noticable effect).
the stack trace below makes me think i somehow found a bug where the entity cache cannot be synchronized, but I'm not experienced enough to tell anything sensible on this part.
06/11/07 14:35:37 [543] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/11/07 14:35:37 [544] valiateToken:Decompressed BC state:BCST:=0%V%=NUrenoverzichtViewIterator=-D-000100000002C109,weekCodesViewIterator=-D-000200000006323030363338000000046261736B,
06/11/07 14:35:37 [545] OracleSQLBuilder Executing Select on: WEEKCODES (false)
06/11/07 14:35:37 [546] Reusing prepared FAULT-IN statement
06/11/07 14:35:37 [547] EntityCache:add ERROR - **new/modified row with same primary key as an existing row**
06/11/07 14:35:37 [548] DCBindingContainer.reportException :oracle.jbo.TooManyObjectsException
06/11/07 14:35:37 [549] oracle.jbo.TooManyObjectsException: JBO-25013: Te veel objecten komen overeen met de primaire sleutel oracle.jbo.Key[200637 bask ].
     at oracle.jbo.server.EntityCache.add(EntityCache.java:553)
     at oracle.jbo.server.EntityCache.replace(EntityCache.java:1065)
     at oracle.jbo.server.EntityImpl.setAttributeValueInternal(EntityImpl.java:2445)
     at oracle.jbo.server.EntityImpl.setAttributeValue(EntityImpl.java:2197)
     at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:1894)
     at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:1076)
     at model.entity.WeekcodesImpl.setWeekcode(WeekcodesImpl.java:48)
     at model.entity.WeekcodesImpl.setAttrInvokeAccessor(WeekcodesImpl.java:91)
     at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:989)
     at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:1312)
     at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:1216)
     at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1116)
     at oracle.jbo.server.ViewRowImpl.setAttrInvokeAccessor(ViewRowImpl.java:1091)
     at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:838)
     at oracle.adf.model.binding.DCDataControl.setAttributeInRow(DCDataControl.java:1956)
     at oracle.adf.model.bc4j.DCJboDataControl.setAttributeInRow(DCJboDataControl.java:1774)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow(JUCtrlValueBinding.java:645)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttribute(JUCtrlValueBinding.java:913)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.updateTargetFromSelectedValue(JUCtrlListBinding.java:1477)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setAttributeFromValueList(JUCtrlListBinding.java:1419)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setSelectedIndex(JUCtrlListBinding.java:720)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setInputValue(JUCtrlListBinding.java:1830)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.put(JUCtrlValueBinding.java:1803)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.put(JUCtrlListBinding.java:1781)
     at com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:158)
     at oracle.adfinternal.view.faces.model.FacesPropertyResolver.setValue(FacesPropertyResolver.java:155)
     at com.sun.faces.el.impl.ArraySuffix.setValue(ArraySuffix.java:192)
     at com.sun.faces.el.impl.ComplexValue.setValue(ComplexValue.java:171)
     at com.sun.faces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:234)
     at oracle.adf.view.faces.component.UIXEditableValue.updateModel(UIXEditableValue.java:323)
     at oracle.adf.view.faces.component.UIXEditableValue.processUpdates(UIXEditableValue.java:284)
     at javax.faces.component.UIForm.processUpdates(UIForm.java:196)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:887)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildren(UIXComponentBase.java:876)
     at oracle.adf.view.faces.component.UIXComponentBase.processUpdates(UIXComponentBase.java:701)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:887)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildren(UIXComponentBase.java:876)
     at oracle.adf.view.faces.component.UIXComponentBase.processUpdates(UIXComponentBase.java:701)
     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:935)
     at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:363)
     at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:81)
     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
     at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
     at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
     at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
     at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
     at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
     at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
     at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
     at java.lang.Thread.run(Thread.java:595)
06/11/07 14:35:37 [550] * * * BindingContainer caching EXCEPTION:oracle.jbo.TooManyObjectsException
I hope someone can help out. obviously i tried google, even google codesearch. but either this is a new problem or I'm using the wrong search terms. i hope someone can help out here.
for starters: thanks for reading this far!
ps: some error parts are dutch for an unknown reason, yet the error codes and exception names are still universal!

i'm using ADF and JSF in Oracle JDeveloper Studio Edition (10.1.3.0.4) with SU5
the project I'm working on, we need to filter on week numbers and usernames, both represented as a string throughout the application. currently we are doing this by defining those 2 parameters in a JSP page in inputtext fields which are bound to a backing bean.
when i press a button, a method is triggered that reads those coreInputText fields in that same backing bean and defines the where clause on the necessary view object. this query runs fine (i took it out of the running log and executed in the database web interface) and most of the time it even runs fine within the page as well.
in fact, it works as long as i leave the filled in filter variables the way they are by default, but when i choose to alter that param it throws a TooManyObjectsException. even tho (as i said) the query runs fine outside the application.
the method applying the filter is within the automatically bound backing bean connected to the JSP page, calling a pageForward which returns to the page it came from.
I'm running out of possible causes for this exception. for the keys are fine as far as i can see. the query itself is good. it does work every 1st attempt (calling a vo.clearCache(); has no noticable effect).
the stack trace below makes me think i somehow found a bug where the entity cache cannot be synchronized, but I'm not experienced enough to tell anything sensible on this part.
06/11/07 14:35:37 [543] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/11/07 14:35:37 [544] valiateToken:Decompressed BC state:BCST:=0%V%=NUrenoverzichtViewIterator=-D-000100000002C109,weekCodesViewIterator=-D-000200000006323030363338000000046261736B,
06/11/07 14:35:37 [545] OracleSQLBuilder Executing Select on: WEEKCODES (false)
06/11/07 14:35:37 [546] Reusing prepared FAULT-IN statement
06/11/07 14:35:37 [547] EntityCache:add ERROR - **new/modified row with same primary key as an existing row**
06/11/07 14:35:37 [548] DCBindingContainer.reportException :oracle.jbo.TooManyObjectsException
06/11/07 14:35:37 [549] oracle.jbo.TooManyObjectsException: JBO-25013: Te veel objecten komen overeen met de primaire sleutel oracle.jbo.Key[200637 bask ].
     at oracle.jbo.server.EntityCache.add(EntityCache.java:553)
     at oracle.jbo.server.EntityCache.replace(EntityCache.java:1065)
     at oracle.jbo.server.EntityImpl.setAttributeValueInternal(EntityImpl.java:2445)
     at oracle.jbo.server.EntityImpl.setAttributeValue(EntityImpl.java:2197)
     at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:1894)
     at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:1076)
     at model.entity.WeekcodesImpl.setWeekcode(WeekcodesImpl.java:48)
     at model.entity.WeekcodesImpl.setAttrInvokeAccessor(WeekcodesImpl.java:91)
     at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:989)
     at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:1312)
     at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:1216)
     at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1116)
     at oracle.jbo.server.ViewRowImpl.setAttrInvokeAccessor(ViewRowImpl.java:1091)
     at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:838)
     at oracle.adf.model.binding.DCDataControl.setAttributeInRow(DCDataControl.java:1956)
     at oracle.adf.model.bc4j.DCJboDataControl.setAttributeInRow(DCJboDataControl.java:1774)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow(JUCtrlValueBinding.java:645)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttribute(JUCtrlValueBinding.java:913)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.updateTargetFromSelectedValue(JUCtrlListBinding.java:1477)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setAttributeFromValueList(JUCtrlListBinding.java:1419)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setSelectedIndex(JUCtrlListBinding.java:720)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setInputValue(JUCtrlListBinding.java:1830)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.put(JUCtrlValueBinding.java:1803)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.put(JUCtrlListBinding.java:1781)
     at com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:158)
     at oracle.adfinternal.view.faces.model.FacesPropertyResolver.setValue(FacesPropertyResolver.java:155)
     at com.sun.faces.el.impl.ArraySuffix.setValue(ArraySuffix.java:192)
     at com.sun.faces.el.impl.ComplexValue.setValue(ComplexValue.java:171)
     at com.sun.faces.el.ValueBindingImpl.setValue(ValueBindingImpl.java:234)
     at oracle.adf.view.faces.component.UIXEditableValue.updateModel(UIXEditableValue.java:323)
     at oracle.adf.view.faces.component.UIXEditableValue.processUpdates(UIXEditableValue.java:284)
     at javax.faces.component.UIForm.processUpdates(UIForm.java:196)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:887)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildren(UIXComponentBase.java:876)
     at oracle.adf.view.faces.component.UIXComponentBase.processUpdates(UIXComponentBase.java:701)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:887)
     at oracle.adf.view.faces.component.UIXComponentBase.updateChildren(UIXComponentBase.java:876)
     at oracle.adf.view.faces.component.UIXComponentBase.processUpdates(UIXComponentBase.java:701)
     at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:935)
     at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:363)
     at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:81)
     at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
     at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
     at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
     at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
     at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
     at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
     at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
     at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
     at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
     at java.lang.Thread.run(Thread.java:595)
06/11/07 14:35:37 [550] * * * BindingContainer caching EXCEPTION:oracle.jbo.TooManyObjectsException
I hope someone can help out. obviously i tried google, even google codesearch. but either this is a new problem or I'm using the wrong search terms. i hope someone can help out here.
for starters: thanks for reading this far!
ps: some error parts are dutch for an unknown reason, yet the error codes and exception names are still universal!

Similar Messages

  • JPA - Select with where clause

    Hi
    I have 2 classes:
    -Class A
    -Class B with a member which holds a reference to an object of Class A --> unidirectional one-to-one relation. The mapping is the following:
                   <one-to-one name="a">
                        target-entity="domain.A" fetch="LAZY"
                        optional="false">
                        <join-column name="ID" table="A" />
                   </one-to-one>
    Now i want to find all objects of B which have a certain instance of A. I tried this, but it doesn't work:
         <named-query name="findBsByA">
              <query>select b from B b where b.a = ?1</query>
         </named-query>
    Any suggestions?
    Thanks for help
    Michael

    name or ID might be reserved words in access. Either change the name of the column or put [] around them. Also, you ar looking for a record where fields name and name1 are equal. You probably don't have a name1 field.
    String name1=nameTextfield.getText().trim();
    String query="SELECT [ID] from Suppliers WHERE [name]='"+name1+"';"
    Pay attention to the single and double quotes I have.

  • Select with Where not in (subSelect)

    Hi,
    Is there any special about that 'not' in this ORacle sql (10g) that it doesn't return me any rows, unlike SQLServer with same code:
    select count(*) from t1_ups where  id_ups not in (select b.id_ups from t1_dups b)
    COUNT(*)              
    0
    vs.
    select count(*) from t1_ups where  id_ups not in ('abc', 'def','xyz')  --select b.id_ups from t1_dups b)
    COUNT(*)              
    16
    DDL:
        "id_ups"            VARCHAR2(20 BYTE),   is the same for both tables.I see that if remove <not> it works fine. is there any OR --> AND converssion happaned with negation?
    My global task is to make UNION "with replacement" when if any records exist in id_dups they will replace ones from id_ups, so I try to do it in separate parts.
    Thanks
    Tr
    Edited by: trento on Nov 16, 2010 3:00 PM

    trento wrote:
    Hi,
    Is there any special about that 'not' in Yes, you need to be aware how the syntax reacts to NULL values.
    create table in_or_not
      col1  number
    TUBBY_TUBBZ?insert into in_or_not values (2);
    1 row created.
    Elapsed: 00:00:00.05
    TUBBY_TUBBZ?select 1 from dual where 1 not in (select col1 from in_or_not);
                     1
                     1
    1 row selected.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?insert into in_or_not values (NULL);
    1 row created.
    Elapsed: 00:00:00.00
    TUBBY_TUBBZ?select 1 from dual where 1 not in (select col1 from in_or_not);
    no rows selected
    Elapsed: 00:00:00.01http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:442029737684

  • Select with where condition comparing different domains

    SELECT *
               FROM table
               FOR ALL ENTRIES IN it_temp
               WHERE col1 =  it_temp-col_id.
    col1 is of type char20
    it_temp-col_id is of type char10.
    "col1" and "it_temp-col_id" must have the same type and the same length.
    do someone know a workaround?
    thanks!!

    types : begin of ity_temp_1,
                   col_temp type table-col1, " this is type 20.
                endof ity_temp_1.
    data: lt_temp_1 type standard table of ity_temp_1,
             ls_temp_1 type ity_temp_1.
    loop at it_temp into is_temp.
        clear ls_temp_1.
        ls_temp_1-col_temp =    is_temp-col1. " passing col1(type 10 to col_temp of type 20.)
        append ls_temp_1 into lt_temp_1.
        clear : is_temp.
    endloop.
    "now lt_temp_1 holds matching domain.
    SELECT *
    FROM table
    FOR ALL ENTRIES IN lt_temp_1 " comparing with passed values with same domain
    WHERE col1 = lt_temp_1-col_temp.

  • SELECT with WHERE clause for MSAccess from JDBC

    Hi,
    I am new user of MSAccess.I am getting exception: Invalid user type when i was trying the following code:
    String name1=nameTextfield.getText().trim();
    String query="SELECT ID from Suppliers WHERE name=name1;"
    Statement stmt=con.createStatement();
    ResultSet rs=stmt.executeQuery(query);
    while(rs.next())
    String id1=rs.getInt(1);
    System.out.println(id1);
    nameTextField is JTextField in my GUI.
    ID id auto field in table Suppliers.
    I am using MSAccess 97.
    I came to know that the JDBC SQL queries will be different for Access.
    Any body help me how to write SELECT statement?
    Thanks in advance,
    Sai Ram

    name or ID might be reserved words in access. Either change the name of the column or put [] around them. Also, you ar looking for a record where fields name and name1 are equal. You probably don't have a name1 field.
    String name1=nameTextfield.getText().trim();
    String query="SELECT [ID] from Suppliers WHERE [name]='"+name1+"';"
    Pay attention to the single and double quotes I have.

  • Select clause with where part is needs 600 times longer to complete

    Hello.
    I have two select clauses one with where, which needs 120 seconds to complete and one without where, which completes in 0,3 seconds. I want to know why is that.
    120 seconds
    SELECT B.* FROM
    (SELECT A.OLOG, MCL_ISPROTOCOLALLOWED('LMOD', 'MCLI', A.OPRG) ALLOWED FROM  (SELECT DISTINCT OLOG, OPRG FROM FLOG WHERE FIRM = '001') A) B WHERE B.ALLOWED = '1' ORDER BY OLOG;0,3 seconds
    SELECT B.* FROM
    (SELECT A.OLOG, MCL_ISPROTOCOLALLOWED('LMOD', 'MCLI', A.OPRG) ALLOWED FROM  (SELECT DISTINCT OLOG, OPRG FROM FLOG WHERE FIRM = '001') A) B ORDER BY OLOG;Table FLOG has arround 270000 records, but only 40 of them are distinct.
    IsProtocolAllowed checks if user has a permision to view the record.
    Thank you for your help.
    Regards,
    Borut Ojcinger
    Edited by: 993896 on 14.3.2013 7:24

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    If you have a performance issue have a look at SQL and PL/SQL FAQ
    Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to create VO with multiple dynamic where clauses on select with UNION?

    I am trying to implement the View Object for the UNION query that looks like this:
         select a,b,c...
              from t1,t2,...
              where dynamic_where_clause1     
         union all
         select a,b,c,...
              from t11,t12, ...
              where dynamic_where_clause2
    There are up to 60 input parameters that are used to generate dynamic where clauses. They are actually created by calling PL SQL function.
    So far, I was not able to assign both where clauses to the view object. Is there a workable solution for this problem, besides resorting to programmatic View Object?
    I understand that recommended way with UNIONs is to wrap both queries into a parent select:
    select * from (
         select a,b,c...
              from t1,t2,...
              where ... -- table relationship joints
         union all
         select a,b,c,...
              from t11,t12, ...
              where ... -- table relationship joints
    ) QRSLT
         where dynamic_where_clause
    Unfortunately this approach doesn't work here, since individual selects are producing unmanageable amount of data and resulting query takes forever to complete.

    I afraid I would not have any real benefits from using VO if I replace the entire query with every request. Actually, the performance may suffer.
    I solved the problem by creating a POJO Data Control and invoking the custom select query from java. Not sure if it is the best approach to the problem, but implementation time is limited and it works.
    Actually, this is not the first time I see the need to implement VO with complicated SQL like select with unions and dynamic pieces. It would be nice to find a solution and not resort to workarounds.
    Edited by: viksicom on Aug 2, 2012 8:48 AM

  • Export (expdp) with where clause

    Hello Gurus,
    I am trying to export with where clause. I am getting below error.
    Here is my export command.
    expdp "'/ as sysdba'" tables = USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= “USER1.TABLE1:where auditdate>'01-JAN-10'” Here is error
    [keeth]DB1 /oracle/data_15/db1> DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate>'01-JAN-10'                    <
    Export: Release 11.2.0.3.0 - Production on Tue Mar 26 03:03:26 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Starting "SYS"."SYS_EXPORT_TABLE_03":  "/******** AS SYSDBA" tables=USER1.TABLE1 directory=DATA_PUMP dumpfile=TABLE1.dmp logfile=TABLE1.log query= USER1.TABLE1:where auditdate
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 386 MB
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
    Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type TABLE_EXPORT/TABLE/TRIGGER
    Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "USER1"."TABLE1" failed to load/unload and is being skipped due to error:
    ORA-00933: SQL command not properly ended
    Master table "SYS"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
    Dump file set for SYS.SYS_EXPORT_TABLE_03 is:
      /oracle/data_15/db1/TABLE1.dmp
    Job "SYS"."SYS_EXPORT_TABLE_03" completed with 1 error(s) at 03:03:58Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

    Hello,
    You should use parameter file.Another question i can see you are using 11g.Why don't you use data pump?.
    Data Pump is faster and have more features and enhancement than regular imp and exp.
    You can do the following:
    sqlplus / as sysdba
    Create directory DPUMP_DIR3  for 'Type here your os path that you want to export to';then touch a file:
    touch par.txt
    In this file type the following the following :
    tables=schema.table_name
    dumpfile=yourdump.dmp
    DIRECTORY=DPUMP_DIR3
    logfile=Your_logfile.log
    QUERY =abs.texp:"where hiredate>'01-JAN-13' "then do the following
    expdp username/password parfile='par.txt'
    If you will import from Oracle 11g to version 10g then you have to addthe parameter "version=10" to the parameter file above
    BR
    Mohamed ELAzab
    http://mohamedelazab.blogspot.com/

  • Outer Join with Where Clause in LTS

    HI all,
    I have a requirement like this in ANSI SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1 left outer join product_group p2 on p1.product_id = p2.product_id
    and p2.product_group = 'NEW'
    In Regular SQL:
    select p1.product_id, p1.product_name, p2.product_group
    from product p1, product_group p2
    WHERE p1.product_id *= p2.product_id and p2.product_group = 'NEW'
    In OBIEE, I am using a left outer join between these two in Logical table Source, and also, Gave
    p2.product_group = 'NEW' in WHERE clause of LTS.
    This doesn't seem to solve purpose.
    Do you have any idea how to convert WHERE clause in physical query that OBIEE is generating to something like
    product p1 left outer join product_group p2 on p1.product_id = p2.product_id AND p2.product_group = 'NEW'
    I am using Version 10.1.3.4.1
    Creating an Opaque view would be my last option though.

    Hello
    I have read your post and the responses as well. and I understand that you have issues with the Outer Join with where Clause in LTS.
    Try this solution which worked for me (using your example ) -
    1. In the Physical Layer created a Complex join between PRODUCT and PRODUCT_GROUP tables and use this join relationship :
    PRODUCT.PROD_ID = PRODUCT_GROUP.PROD_ID  AND  PRODUCT_GROUP.GROUP_NAME = 'MECHANICAL' 
    2. In the General Tab of PRODUCT table LTS add PRODUCT_GROUP  table and select Join Type as Left Outer Join.
    3. Check Consistency and make sure there are no errors .
    when you run a request you should see the following query generated -
    select distinct T26908.PROD_ID as c1,
         T26908.PROD_NAME as c2,
         T26912.GROUP_NAME as c3
    from
         PRODUCT T26908 left outer join PRODUCT_GROUP T26912 On T26908.PROD_ID = T26912.PROD_ID and T26912.GROUP_NAME = 'MECHANICAL'
    order by c1, c2, c3
    Hope this works for you. If it does please mark this response as 'Correct' .
    Good Luck.

  • Delete statement that uses a sub-select with the statement in the cursor

    Hi all,
    How to write write a delete statement that uses a sub-select with the statement in the cursor?
    CURSOR excluded_dates IS         
           SELECT TO_TIMESTAMP(report_parameter_value, in_date_format_mask)
          INTO my_current_date_time
          FROM report_parameters
         WHERE report_parameters.report_parameter_id    = in_report_parameter_id
           AND report_parameters.report_parameter_group = 'DATE_TIME'
           AND report_parameters.report_parameter_name  = 'EXCLUDED_DATE';
    OPEN excluded_dates;
      LOOP
        FETCH excluded_dates INTO my_excluded_date;
        EXIT WHEN excluded_dates%NOTFOUND;
        DELETE FROM edr_rpt_tmp_inclusion_table
        WHERE TO_CHAR(date_time, 'mm/dd/yyyy') = TO_CHAR(my_excluded_date, 'mm/dd/yyyy');
      END LOOP;
      CLOSE excluded_dates;Thanks

    Hi,
    In such case I think is better to create a view an perform the delete using it. Example (using HR schema):
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> create or replace view v_employees as select * from employees where first_name like 'J%';
    View created
    SQL> select * from v_employees;
    EMPLOYEE_ID FIRST_NAME           LAST_NAME                 EMAIL                     PHONE_NUMBER         HIRE_DATE   JOB_ID         SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
            110 John                 Chen                      JCHEN                     515.124.4269         28/09/1997  FI_ACCOUNT    8200,00                       108           100
            112 Jose Manuel          Urman                     JMURMAN                   515.124.4469         07/03/1998  FI_ACCOUNT    7800,00                       108           100
            125 Julia                Nayer                     JNAYER                    650.124.1214         16/07/1997  ST_CLERK      3200,00                       120            50
            127 James                Landry                    JLANDRY                   650.124.1334         14/01/1999  ST_CLERK      2400,00                       120            50
            131 James                Marlow                    JAMRLOW                   650.124.7234         16/02/1997  ST_CLERK      2500,00                       121            50
            133 Jason                Mallin                    JMALLIN                   650.127.1934         14/06/1996  ST_CLERK      3300,00                       122            50
            139 John                 Seo                       JSEO                      650.121.2019         12/02/1998  ST_CLERK      2700,00                       123            50
            140 Joshua               Patel                     JPATEL                    650.121.1834         06/04/1998  ST_CLERK      2500,00                       123            50
            145 John                 Russell                   JRUSSEL                   011.44.1344.429268   01/10/1996  SA_MAN       14000,00           0,40        100            80
            156 Janette              King                      JKING                     011.44.1345.429268   30/01/1996  SA_REP       10000,00           0,35        146            80
            176 Jonathon             Taylor                    JTAYLOR                   011.44.1644.429265   24/03/1998  SA_REP        8600,00           0,20        149            80
            177 Jack                 Livingston                JLIVINGS                  011.44.1644.429264   23/04/1998  SA_REP        8400,00           0,20        149            80
            181 Jean                 Fleaur                    JFLEAUR                   650.507.9877         23/02/1998  SH_CLERK      3100,00                       120            50
            186 Julia                Dellinger                 JDELLING                  650.509.3876         24/06/1998  SH_CLERK      3400,00                       121            50
            189 Jennifer             Dilly                     JDILLY                    650.505.2876         13/08/1997  SH_CLERK      3600,00                       122            50
            200 Jennifer             Whalen                    JWHALEN                   515.123.4444         17/09/1987  AD_ASST       4400,00                       101            10
    16 rows selected
    SQL> delete from v_employees where hire_date >= to_date('01/06/1998', 'dd/mm/yyyy');
    2 rows deleted
    SQL> regards,

  • MODIFY with Where

    Hi Gurus,
    Could you please give me the code, on how can I use the modify with where statement to update dictionary table from an internal table. In this case, I don't want to use update with set statement as I have many fields.
    Thanks,
    David.

    hi,
    TABLES : mkpf,
             mseg,
             zamatdoc,
             mara.
    DATA :BEGIN OF gi_mkpf OCCURS 100,
          mblnr LIKE mkpf-mblnr,
          mjahr LIKE mkpf-mjahr,
          END OF gi_mkpf.
      data gi_mseg like zamatdoc occurs 100 with header line.
    DATA: BEGIN OF gi_mseg OCCURS 0.
            INCLUDE STRUCTURE zamatdoc.
    DATA: END OF gi_mseg.
    DATA: gv_date(11)," LIKE ekpo-aedat,
          gv_date1(11),
          year(4),
          month(2),
          day(2),
          flag(1),
          read_flag(1).
    DATA :char TYPE i,
          count TYPE i.
    *select-options : s_mtart for mara-mtart obligatory.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-110.
    SELECT-OPTIONS : records FOR char. " OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    START-OF-SELECTION.
      gv_date1 = sy-datum.
      year = gv_date1+0(4).
      month = gv_date1+4(2).
      day = gv_date1+6(2).
      year = year - 3.
      CLEAR gv_date1.
      CONCATENATE year month day INTO gv_date1.
    CONCATENATE day month year INTO gv_date1.
      SELECT mblnr
             mjahr
             FROM mkpf
             INTO TABLE gi_mkpf
             WHERE  budat <= gv_date1.">" and BUDAT >=  ).
      IF sy-subrc = 0.
        SORT gi_mkpf BY mblnr.
        DELETE ADJACENT DUPLICATES FROM gi_mkpf.
        CLEAR count.
        IF NOT gi_mkpf[] IS INITIAL.
          IF NOT records-low IS INITIAL .
            IF NOT records-high IS INITIAL.
              DESCRIBE TABLE gi_mkpf LINES count.
              IF records-high < count.
                DELETE gi_mkpf FROM records-high TO count.
              ENDIF.
              IF records-low <> 1.
                IF records-low <> 0.
                  DELETE gi_mkpf FROM 1 TO records-low.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
    SELECT matnr werks FROM mseg INTO CORRESPONDING FIELDS OF TABLE gi_mseg
        PACKAGE SIZE 100  FOR ALL ENTRIES IN gi_mkpf
               WHERE mblnr = gi_mkpf-mblnr
                 AND mjahr = gi_mkpf-mjahr.
          MODIFY zamatdoc FROM TABLE gi_mseg.
          COMMIT WORK.
        ENDSELECT.
    regards
    siva

  • How to avoid select with in a loop.

    Hi friends,
    can any tell how to avoid the select with in a loop for the following code, since it badly effecting my performance. if possible with code
    SELECT matnr werks
          FROM marc
          INTO TABLE it_marc
          FOR ALL ENTRIES IN it_ausp_1
          WHERE matnr = it_ausp_1-objek AND
             werks = p_werks
            AND mmsta LE 60.
        SORT it_marc BY matnr.
        CLEAR wa_ausp_1.
        CLEAR wa_tabix.
        LOOP AT it_ausp_1 INTO wa_ausp_1.
          wa_tabix = sy-tabix.
          READ TABLE it_marc INTO wa_marc WITH
            KEY matnr = wa_ausp_1-objek
            BINARY SEARCH.
          IF sy-subrc EQ 0.
          ELSE.
            DELETE it_ausp_1 INDEX wa_tabix.
          ENDIF.
        ENDLOOP.                      " LOOP AT it_ausp_1 INTO wa_ausp_1.
        APPEND LINES OF it_ausp_1 TO it_tal.
      IF it_tal[] IS NOT INITIAL.
        LOOP AT t_plan_order INTO fs_plan_order.
          SELECT r~rsnum
                 r~rspos
                 r~matnr
                 r~nomng
                 r~meins
                 r~plnum
                 r~bdter
                 r~ewahr
                 r~alprf
                 r~posnr
                 r~baugr
                 m~dispo
              INTO TABLE t_resb
              FROM resb AS r
              INNER JOIN marc AS m
              ON rbaugr = mmatnr
             AND rwerks = mwerks
             FOR ALL ENTRIES IN it_tal
             WHERE r~rsnum = fs_plan_order-rsnum
               AND r~matnr = it_tal-objek
               AND r~xloek = ' '
               AND r~werks = p_werks.
          APPEND LINES OF t_resb TO t_tacl.
        ENDLOOP.

    SELECT r~rsnum r~rspos r~matnr  r~nomng r~meins r~plnum r~bdter r~ewahr r~alprf r~posnr r~baugr m~dispo
              INTO TABLE t_resb
              FROM resb AS r
              INNER JOIN marc AS m
             ON r~baugr = m~matnr
             AND r~werks = m~werks
             FOR ALL ENTRIES IN it_tal
             WHERE r~rsnum = fs_plan_order-rsnum
             AND r~matnr = it_tal-objek
             AND r~xloek = ' '
             AND r~werks = p_werks.
    The logic of this select is completely weird. Whcih order of the db-tables should be used, which indexes?
    On RESB matnr, werks and xloek are in one index, but rsnum not.
    Are the conditions in fs_plan_order and it_tal connected or independent?
    It is probably much faster, to leave the  fs_plan_order condition away and check it on the result.
    SELECT r~rsnum r~rspos r~matnr  r~nomng r~meins r~plnum r~bdter r~ewahr r~alprf r~posnr r~baugr m~dispo
              INTO TABLE t_resb
              FROM resb AS r
              INNER JOIN marc AS m
             ON   m~matnr  = r~baugr
             AND m~werks =  r~werks
             FOR ALL ENTRIES IN it_tal
             WHERE         AND r~matnr = it_tal-objek
             AND r~xloek = ' '
             AND r~werks = p_werks.
    sort fs_plan_order by rsnum.
    loop at it_tal in wa.
       read table fs_plan_order
              with key rsnum = wa-rsnum
              binary search.
       if sy-subrc eq 0.
         append ...
       endif.
    endloop.
    Siegfried

  • Merge with where clause after matched and unmatched

    Hai,
    Can anybody give me one example of merge statement with
    where clause after matched condition and after the unmatched condition.
    MERGE INTO V1 VV1
    USING (SELECT     A.CNO XXCNO, A.SUNITS XXSU, A.DDATE XXDD, XX.SUM_UNITS SUMMED
    FROM V1 A,
    (SELECT                
    SUM(SUNITS) SUM_UNITS FROM V1 B                                   
    GROUP BY CNO) c
    WHERE
    A.DDATE=0 AND A.SUNITS <>0 AND
    A.ROWID=(SELECT MAX(ROWID) FROM V1 )) XX
    ON (1=1)
    WHEN MATCHED THEN UPDATE SET
    VV1.SUNITS=XX.SUMMED
    WHERE XX.XXDD=0
    WHEN NOT MATCHED THEN INSERT
    (VV1.CNO, VV1.SUNITS, VV1.SUNITS)
    VALUES (XX.XXCNO, XX.XXSU, XX.XXDD)
    WHERE XX.XXDD<>0
    i am getting the error
    WHERE XX.XXDD=0
    ERROR at line 13:
    ORA-00905: missing keyword
    Thanks,
    Pal

    One of the example is there:
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_9016.htm#sthref7014
    What Oracle version do you use ?
    Besides the condition (1=1) is non-deterministic,
    I would expect there an exception like "unable to get a stable set of rows".
    Rgds.

  • Insert with Where Clause

    Hi,
    Can we write Insert with 'Where' clause? I'm looking for something similar to the below one (which is giving me an error)
    insert into PS_AUDIT_OUT (AUDIT_ID, EMPLID, RECNAME, FIELDNAME, MATCHVAL, ERRORMSG)
    Values ('1','10000139','NAMES','FIRST_NAME',';','')
    Where AUDIT_ID IN
    (  select AUDIT_ID from PS_AUDIT_FLD where AUDIT_ID ='1' and RECNAME ='NAMES'
    AND FIELDNAME = 'FIRST_NAME' AND MATCHVAL = ';' );
    Thanks
    Durai

    It is not clear what are you trying to do, but it looks like:
    insert
      into PS_AUDIT_OUT(
                        AUDIT_ID,
                        EMPLID,
                        RECNAME,
                        FIELDNAME,
                        MATCHVAL,
                        ERRORMSG
    select  '1',
            '10000139',
            'NAMES',
            'FIRST_NAME',
      from  PS_AUDIT_FLD
      where AUDIT_ID = '1'
        and RECNAME ='NAMES'
        and FIELDNAME = 'FIRST_NAME'
        and MATCHVAL = ';'
    SY.

  • Hierarchical query with where clause

    Hi,
    How can I query hierarchically a query with WHERE clause? I have a table with three fields session_id,id and root_id.
    When I try with the following query,
    select id, level from relation
    where session_id = 79977
    connect by prior id = root_id start with id = 5042;
    It gets duplicate values.
    I want the query to show in the hierarchical manner with a filter condition using WHERE clause. Please help me how can I achieve this. If you know any link that describes more about this, please send it.
    Thanks in Advance.
    Regards,
    -Parmy

    Hi Sridhar Murthy an others,
    Thanks a lot for your/the answer. It's working for me. It saved a lot of other work around without the proper knowledge of hierarchical query. Please send me any link that describes these issues in detail and also I hope as I have mentioned in the other message, same cannot be achieved on views or ( on two different tables ???)
    Any way thanks for your reply,
    It's working for me.
    With happiness,
    -Parmy

Maybe you are looking for