Bug in View Criteria for EXISTS operator

Hello!
I have two VO:
DEP (ID, TITLE, STATUS)
EMP (ID, ID_DEP, NAME)
and viewlink DEP.ID <- EMP.ID_DEP
in DEP VO i create view criteria and add two items:
* DEP.STATUS <> 1000
* the EMPVO with EXISTS operator (and after that add condition EMP.NAME contain :nName (bind var))
start app, set "john" in search field, press button "search" and in debug console i found sql for searching in DEP:
SELECT *
FROM (SELECT DEP.ID,
DEP.TITLE,
FROM DEP DEP
where (DEP.STATUS is null OR DEP.STATUS <> 1000)) QRSLT
WHERE ((((EXISTS (SELECT 1
FROM EMP EMP
WHERE ((UPPER(EMP.NAME) LIKE
UPPER('%' || :nName || '%')))
AND (ID = EMP.ID_DEP))))))
in last row present error, must be:
AND (QRSLT.ID = EMP.ID_DEP))))))
coz if no "QRSLT", sql parser think what need compare EMP.ID and EMP.ID_DEP.
Present in JDeveloper 11.1.1.2.0, 11.1.1.3.0.

We have implemented our own ViewCriteriaAdater (derived from oracle.jbo.server.OracleSQLBuilderImpl) and some custom properties to handle this. Overwrite the getFormattedRHSCompareFragment to your needs.
Btw. I think this posting should go to the JDev forum.

Similar Messages

  • How to apply common View criteria for all LOV View programatically?

    Hi,
    In my application I use nearly 100 VOs, which will be mapped as LOV to some base VOs. These VOs are not only for LOV but also will be used directly in screen as read-only table. All these VOs contains EFF_BGN_DTand EFF_END_DT. Requirement is to display only the active records in VO.
    We don't want to crete view criteria at design time for each and every VO. Instead we want to have a base ViewObjectImpl class, create at runtime and add this common criteria with the existing view criterias (If any given, which are actually required for the developer for screen specific functionality).
    NOTE: As all of our VOs are custom java data source implemented and none of them have queries, we cannot use whereclause API but only ViewCriteria.
    We want to create a view criteria, that somewhat looks like the below condition.
               (     (TO_CHAR( EffBgnDt, 'yyyy-mm-dd') <= '2010-02-01' )
                 AND (TO_CHAR( EffEndDt, 'yyyy-mm-dd') >= '2010-02-01' )
                 OR
               (     (TO_CHAR( EffBgnDt, 'yyyy-mm-dd') <= '2010-02-01' )
                 AND (EffEndDt IS NULL )
               )Question:
    1. Which is the best place in ViewObject class, where I will be able to create common view criteria, include it with existing criterias.
    Thanks in Advance.
    Raghu

    No it is not working. I've tested. When i test your implementation in my sample using AM tester, it is not at all going inside getCriteriaItemClause(ViewCriteriaItem pViewCriteriaItem). For example when i say, AM.findViewObject(String ViewObjectName), followed by getEstimatedRowCount(), it should apply common filter criteria and give me the result.
    Given below required scenario:
    Department table:
    ID     DEPT_NAME     START_DATE     END_DATE
    1     Hr          1-Jan-2010     
    2     Purchasing     1-Jan-2010     31-Dec-2010
    3     Shipping             1-Jan-2010     31-Dec-2055
    4     Sales          1-Jan-2010     
    Common criteria to be applied (Programatically) : :bind_current_date between StartDate and EndDate or :bind_current_date >= StartDate and EndDate is null
    VO specific view criteria (may vary VO to VO): DeptName not equal to 'Sales'
    Expected Result:
    Case 1:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. DeptView.getEstimatedRowCount()
              It should give me 3 records (Hr, Shipping, Sales)
    Case 2:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Create View Criteria 'NotSalesDeptVC', which should not list out Sales department.
             c. Apply NotSalesDeptVC using RowSet rowSet = (RowSet) this.findByViewCriteria(NotSalesDeptVC, -1, ViewObject.QUERY_MODE_SCAN_VIEW_ROWS)
             d. rowSet.getEstimatedRowCount()
              It is in-memory filtering, will not disturb the default rowset, should give me 2 records (Hr, Shipping)
    Case 3:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Apply 'NotSalesDeptVC' to the default row set, followed by executeQuery
             c. DeptView.getEstimatedRowCount()
              It should give me 2 records. (Hr, Shipping)
    Case 4:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Unapply the applied 'NotSalesDeptVC', followed by executeQuery
             c. DeptView.getEstimatedRowcount()
              It should give me 3 records (Hr, Shipping, Sales)Essence is at any point of time, User should always work with active records. He no need to write extra logic to retrieve only the active records but the base Viewobject impl should have. Note, All of my view objects are custom java data source implemented and not query based. Similarly it does not meant that all of my VOs will be having some business specific View criteria. Some VOs may have. Some VOs may not have. However basic active records criteria is applicable for all VOs

  • Bizarre behavior of a View Criteria for a View Object

    Hey,
    I remarked quite a bizarre behavior of the View criteria that I created for my view object, using bind variables.
    lets say I have the generated query in the View object:
    SELECT Paquet.ID,
    Paquet.WEIGHT,
    Paquet.VALUE,
    Paquet.ORIGIN,
    Paquet.DESTINATION
    FROM PAQUET Paquet
    I want to use the executeWithParams with bind variables for this View object.
    I create a bind variable:p_o
    I create the View Criteria vith the visual editor that generates an additional view clause:
    ( ( ( Paquet.ORIGIN LIKE ('%' || :p_o || '%') ) OR ( :p_o IS NULL ) ) )
    test query works and explain plan as well.
    Now, when I execute the view object on a page with the bind variable properly set, I get the error: java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: p_o
    Then I copy the where clause generated by view criteria visual edito directly to the query and delete the View Criteria, and it ALL WORKS FINE
    If has to work like that, then what is the View Criteria useful for? I still think that there is a problem.
    Thanks!
    Taavi

    Hi,
    ViewCriterias are not accessed with ExecuteWith Params. For this the bind variable needs to be in the where clause. Named ViewCriterias are listed separately in the DC list
    Frank

  • Change Selection criteria for existing report in Report painter

    Hi Experts,
    We are on 4.7, using report painter for getting reports for Cost center & Profit Center. For one of the report we have selection criteria as Cost center and cost center group, but now user want us to add new selection field as Cost element and cost element Group to same report. We have tried all the options from GR32 ->Edit-> General Selection, but we don't find cost element in Key figure listed there.
    Please let us know how can we add the new field to selection criteria. We also would like to know is this is possible with existing report  to add new fields or not? Is that we need to create new report for this?
    Thanks in advance..
    Shilpa

    Shilpa-
    In my opinion the best way to troubleshoot issues like this is to go to SAP delivered standard reports and see how they are setup. For example, in your case you want to add cost element and cost element group to your report. There is one standard report from SAP - Transaction :S_ALR_87013611 which has both cost center, cost center group and cost element, cost element group in the selection criteria. You can look how this report is set up, and maintain your report in a similar fashion. Atleast this way, it will give you an idea.
    Go to transaction code GRR3 and under library look for report "1SIP-001". By double clicking on the row, you will see how it is maintained.
    Hope this helps.
    Shail

  • Oracle.jbo.NoDefException: Error in Quick Search when we use View  Criteria

    We encountered NoDefException error in Quick Search. We are using JDeveloper 11.1.1.6.0, JHeadstart 11.1.1.4
    I am able to reproduce the error by applying Oracle's HR schema. The following are the steps to reproduce with HR schema:
    1. Create an employee view named EmpVw by using the following query:
    select
    employee_id,
    first_name,
    last_name,
    email,
    phone_number,
    salary
    from employees
    2. Create a lookup view named CountryLookupView by using the following query:
    select
    country_id,
    country_name
    from countries
    3. Create a view named EmpCountryVw by using the following query:
    select
    emp.employee_id,
    emp.first_name,
    emp.last_name,
    cnty.country_id,
    cnty.country_name
    from employees emp
    inner join departments dept
    on emp.department_id = dept.department_id
    inner join locations loc
    on dept.location_id = loc.location_id
    inner join countries cnty
    on loc.country_id = cnty.country_id
    4. Create a LOV for the CountryId attribute in EmpCountryVw. The data source for this LOV is the CountryLookupView we just created. UI hints list type is Input Text with List of Values.
    5. Create View Criteria for EmpVw view, name it as EmpVwSearchCriteria Select EmpCountryVw from Attribute list, Operator is Exists, Operand is Inline View Criteria.
    6. Create new service EmployeeSearchService. Select EmpVw to the data model.
    7. In JHeadStart Application Definition Editor, create a new service node EmloyeeSearchService, set EmpVwSearchCriteria as Quick Search View Criteria in Search Settings section. Run the JAG, and then run the application.
    8. On the application screen, select EmployeeSearchService from the module drop-down list, on Emp Vw screen, click the glass icon to display the pop-up country search dialog, type in CA as country code, run the search, select the row with "Ca Canada" and then click OK button to close off the pop-up dialog. on Emp Vw screen, click "->" to run the search with Country Id = CA. Note the error dialog popup.
    The error message is: oracle.jbo.NoDefException: JBO-25058
    Caused by: oracle.jbo.NoDefException: JBO-25058: Definition data_MyJhsTutorial_UIShellPageDef_mainRegion_oracle_hr_pageDefs_EmpVwPageDef_WEB_INF_adfc_config_EmpVw_xml_EmpVwTaskFlow_EmpVwIteratorEmpVwSearchCriteriaQuery.vcrow125.EmpCountryVw.EmpCountryVwNestedCriteria.vcrow128.CountryId of type Attribute is not found in EmpVw.
         at oracle.jbo.server.ViewObjectImpl.findAttributeDef(ViewObjectImpl.java:7310)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._isTransientAttribute(FacesCtrlSearchBinding.java:585)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._changeQueryModeIfNeeded(FacesCtrlSearchBinding.java:577)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:397)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         ... 63 more
    Please let me know if you have solution for this error. Thanks in advance.
    Sarah

    Sarah,
    I could reproduce the error.
    However, I created a drag-and-drop page fragment with quick search and table, and modified the adfc-config-EmpVw task flow to reference the drag and drop page:
    <view id="EmpVwTable">
    <page id="__120">/EmpvwDD.jsff</page>
    </view>
    And then I still get the same error, so this looks like an ADF bug to me.
    I also created a stand-alone jspx page using drag and drop, same error as well. I suggest you make a testcase without JHeadstart and contact Oracle Support.
    Steven Davelaar,
    JHeadstart Team.

  • ADF 11.1.13 View Criteria

    suppose the following senario in ADF 11.1.1.3
    i want to add a view criteria on an Date attribute such it value between to values
    using befor and after condition not between (to enable one of value is null)
    but the ADF give out of index error when i try to edit the criteria next time and i can't run it

    Not sure, but you may have hit bug 9245990 (or a variant of it). This happens if you use the same attribute twice in one view criteria. It should be fixed in 11.1.2, so you either update to this version, ask for a back port to your version or use this workaround:
    1) create one view criteria for the before part
    2) create one view criteria for the after part
    3) create the final view criteria combining 1) and 2)
    Timo

  • View Criteria in ADF Query Panel with Table-Class Cast Exception

    Hi,
    I am getting Class Cast Exception when using view criteria for ADF Query Panel with Table. The version I am using is 11g Release 1(11.1.1.2.0)
    Here is what I did:
    1. created a view criteria on a view object
    2. all are optional
    3. all are Strings
    3. Dragged the view criteria as a query component (ADF Query panel with Query table) on to the design layout
    and the error when I clicked the Search button is:
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1289)
    at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sni.foundation.facesextensions.filters.FoundationFilter.doFilter(FoundationFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4549)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4603)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
    Thanks
    Venkatesh

    Hi Frank.
    I'm using JDev 11.1.1.3.0 as you suggest the error is no longer present in the latest version.
    I can pick my query from the "Saved Search" pick list on the QueryPanel list of queries just fine, and it sets up the filter properly, but when I press the "Search" button, I get the same reported error...
    <RegistrationConfigurator><handleError> Server Exception during PPR, #1
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1303)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4588)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4642)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:424)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         ... 42 more

  • Learning the basics of EXISTS operator

    I am learning the basics of EXISTS operator.
    create table loans
    (acc_id number,
    balance number(10,2));
    insert into loans
      (acc_id, balance)
    values
      (100, 20000);
    insert into loans
      (acc_id, balance)
    values
      (110, 22000);
    insert into loans
      (acc_id, balance)
    values
      (120, 7000);
    insert into loans
      (acc_id, balance)
    values
      (130, 172.99);
    SQL> select * from loans;
        ACC_ID    BALANCE
           100      20000
           110      22000
           120       7000
           130     172.99
    create table defaulters
      (cust_id number,
       name    varchar2(20),
       acc_id  number);
    insert into defaulters
      (cust_id, name, acc_id)
    values
      (1,'Vajaal',110);
    insert into defaulters
      (cust_id, name, acc_id)
    values
      (2,'Mostert',130);
    SQL> select * from defaulters;
       CUST_ID NAME                     ACC_ID
             1 Vajaal                      110
             2 Mostert                     130
    SQL> select acc_id from loans
      2  where exists(select 1 from defaulters
      3  where loans.acc_id=defaulters.acc_id);
        ACC_ID
           110
           130It just returns all acc_id rows in Loans table which has corresponding ACC_IDs present in defaulters.
    On 10gR2 SQL Reference, for EXISTS operator, it says ' An EXISTS condition tests for existence of rows in a subquery' .
    Would it be wrong if i say, EXISTS operator can be used when you want to return all rows in the Outerquery which has matching records in the Innerquery.

    Would it be wrong if i say, EXISTS operator
    can be used when you want to return all rows in the
    Outerquery which has matching records in the
    Innerquery.Depends on what you understand with "matching".
    See following examples:
    In this case matching means "<>" i.e. return all loans who have at least one row that differs in defaulters table (of course it returns all loans, because defaulters has 2 rows with different acc_id, BTW look also for NULLs and comparisons involving NULLs)
    SQL> ed
    Wrote file afiedt.buf
      1  select acc_id from loans
      2  where exists(
      3    select 1 from defaulters
      4*   where loans.acc_id<>defaulters.acc_id)
    SQL> /
        ACC_ID
           100
           110
           120
           130See also following query:
    SQL> ed
    Wrote file afiedt.buf
      1  select acc_id from loans
      2  where exists(
      3    select 1 from defaulters
      4* )
    SQL> /
        ACC_ID
           100
           110
           120
           130There isn't any condition at all, so any row in defaulters is "matching" row in this case.
    So I'd stick with explanation in documentation this time ;)
    Gints Plivna
    http://www.gplivna.eu

  • Named View Criteria with no wizard - I write the SQL

    Using JDeveloper/ADF 11.1.2.3.
    Is there a way to create a named View Criteria with a SQL Select that is more complex than the wizard can write?
    I know that I can write code to create a View Criteria at runtime, but then I can't just drag and drop it like a named one.
    One use case:
    I have a table named FACILITIES, with a detail table named FACILITY_SERVICES. I want a view criteria for FACILITIES that finds all facilities that have all the required services in a bind variable that is a comma delimited list.
    WHERE list.to_vc_array(:requiredServices) /* I wrote this function to translate a comma delimited list to my own vc_arraytype. */
       SUBMULTISET OF
          CAST(MULTISET ( SELECT service
                            FROM facility_services
                           WHERE facilities.facility_id = facility_services.facility_id)
               AS vc_arraytype)With the wizard, I can't even write a simple IN query (match at least one of the required services), much less this more complex one (match ALL the required services).

    I'm not sure that this is so bad :)
    You need to implement one interface and override one method.
    For example:
    public class YourVOImpl extends ViewObjectImpl implements ViewCriteriaAdapter {
        protected void create() {
            super.create();
            setViewCriteriaAdapter(this);
        @Override
        public String getViewCriteriaClause(ViewObject viewObject, ViewCriteria viewCriteria) {
            if (viewCriteria == null || viewCriteria.size() == 0) return null;
            return "list.to_vc_array(:requiredServices)\n" +
                      "   SUBMULTISET OF \n" +
                      "      CAST(MULTISET ( SELECT service\n" +
                      "                        FROM facility_services\n" +
                      "                       WHERE facilities.facility_id = facility_services.facility_id)\n" +
                      "           AS vc_arraytype)");
    }Dario

  • Set view criteria on af:query choice LOV field

    i have an af:query. one of the fields is a choice. the LOV for the choice come from a VO. i need to set view criteria for the query for the LOV for the choice. that is, the query for the values of the choice requires view criteria.
    moreover, that search criteria is only known by the view. because the hooks for the choice are set up entirely in the model, i don't see how it would ever be possible to use values from the view to define the query for the LOV for the choice.
    any ideas?

    Assuming that you can have a method at the AM level that sets the viewCriteria for your VO, you can drag this method to the page flow to be executed before you go into the query page - this will set the right condition for the list that needs to populate the LOV.
    Then the query component can use that VO as an LOV like this:
    http://blogs.oracle.com/shay/2009/12/adf_query_with_parameters_and_1.html

  • View Criteria and Transient fields

    Hello, I was wondering, is it possible to have View Criteria set on a Transient field? I have created a Transient field named "Field1". I then go to the Query tab in my ViewObject and select the option "Create new view criteria". Here I select the option "Add Item" and from Attribute list I select my field "Field1". However what I notice is that the "View Object Where Clause" does not get updated when the attribute I select is a transient field - when it is a normal field (i.e. from an Entity) it does get updated. This means that I am unable to create view criteria for transient fields. Is there a way how I can manage to do this?

    Transient attributes are not based on database columns. This means that WHERE-clause on transient attributes is a non-sense. It makes sense to add conditions on transient attributes only if the view criteria will be executed as a filter in memory (see the "Query Execution Mode" property in the "Create View Criteria" dialog).

  • Programmtically Setting View Criteria in ADF Query Component

    I have created two view criterias for a View Object and used ADF Query component for searching. User can select any one of the View Criteria from "saved search" in ADF Query component. but i want to set it programmatically based on some business rules. How i can do that?

    No I don't want to set view criteria on search click. Actually I have ADF Query component on my page which is by default disabled. There are also some fields outside the query component on the value of which i enable ADF Query component and wants to set a particular ViewCriteria based on context. All ViewCriterias are defined and listed in "saved search" of ADF Query component but i don't want to allow user to select it but wants to application set it automatically based on context. For it i will be needed to set a particualar ViewCriteria for ADF Query component through code and then refresh ADF Query component to show newly set ViewCriteria. I know how to refresh query component or any other component through code but don't know how to set ViewCriteria on ADF Query component?

  • Named View Criteria and Range paging don't work together

    Hi,
    I am using a named view criteria for a view whose access mode is set to range paging.
    When I use the named view criteria on my page to do a search I am getting the below error. If I don't use range paging as access mode for the view I don't get this error. Looks like when I use the search it doesn't pass the row numbers properly and they are not set in the query.
    Is this a known issue or am I missing something?
    Thanks
    SQL error during statement preparation.  Statement: Select *
      From (Select /*+ FIRST_ROWS */
             IQ.*, ROWNUM As Z_R_N
              From (Select Persons.PRINCIPAL_NAME,
                           Persons.PERSON_ID,
                           Persons.TITLE,
                           Persons.FIRST_NAME,
                           Persons.LAST_NAME,
                           Persons.PHONE_NUMBER
                      From PERSONS Persons
                     Where ((((UPPER(Persons.FIRST_NAME) Like UPPER('%' || :p_name || '%')) Or (:p_name Is Null))))) IQ
             Where ROWNUM < :1)
    Where Z_R_N > :2
    Missing IN or OUT parameter at index:: 4 Message was edited by:
    Muhammed Soyer

    Hi Frank,
    I didn't test it in 10g. It was something that I came across and thought that it might be a known issue..
    The query is not something that I built manually. My entity is created from a table and my view is using the entity. I added a Named Criteria to the view and used Range Paging as access mode for the view.
    The actual query is this
    SELECT Persons.PRINCIPAL_NAME,
           Persons.PERSON_ID,
           Persons.TITLE,
           Persons.FIRST_NAME,
           Persons.LAST_NAME,
           Persons.PHONE_NUMBER
    FROM PERSONS Persons

  • Blog post : "Bug in Create/Edit View Criteria Wizard (JDeveloper 11g)"

    hi
    Using steps 1 to 13 from the blog post "Bug in Create/Edit View Criteria Wizard (JDeveloper 11g)" by Andrejus Baranovskis, I have been able to reproduce the issue he describes.
    see http://andrejusb.blogspot.com/2008/12/bug-in-createedit-view-criteria-wizard.html
    I the blog post comments he writes "... there was no time for me to fill bug in Metalink ...".
    Maybe someone from Oracle can pick it up from this forum post and file it as a bug if it is one (and if possible post the bug number here).
    many thanks
    Jan Vervecken

    The mechanism is to create a reproduceable test case, create a Service Request in metalink.oracle.com, post the test case, and convince the analyst to file it as a bug.
    It may be not efficient at some time, but this the way it is handled.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Issue in Creating an "EXISTS" View Criteria

    Hi,
    Jdev -11.1.1.5.0
    Following is the usecase to apply 'Exists' View criteria.
    We have one NodesEO and two VOs (NodesVO & TopicsVO) which are from same NodesEO.
    NodesVO=> Used to form tree structure . Filtering topics with topic_type is null
    SELECT * FROM MD_TOPICS NodesEO WHERE NodesEO.TOPIC_TYPE is null and doc_name is not null ORDER BY NodesEO.DOC_NAME
    TopicsVO=> Used to prepare ADF table based on selected tree nodes. Filtering nodes with topic_type is not null
    SELECT * FROM MD_TOPICS NodesEO WHERE NodesEO.TOPIC_TYPE is not null
    Issue: As of now, iam preparing list of selected nodes from tree and then sending the comma separated string to IN clause.
    As there is limitation for maximum number of expressions in a list is 1000.
    Iam trying to Create an 'EXISTS' View Criteria. So i got reference to implement the same.
    http://one-size-doesnt-fit-all.blogspot.in/2011/02/adf-bc-creating-exists-view-criteria.html
    Look like, we need to have ViewLink to create EXISTS VC. I tried to create VL from TopicsVOToNodesVO. At the end, I dragged the TopicsVO instance as a table on jsff.
    Here iam unable to filter the rows from NodesVO based on checkbox status.
    Iam using transient attribute (checkboxConfirmedStatus- String, checkboxCOnfirmed- boolean). Here i've applied VC on transient attribute by selecting 'In memory' option.
    At run time, iam getting exception.
    <QueryCollection> <buildResultSet> [1729] java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: bind_checkboxConfirmed
    Please suggest any option to filter the rows from NodesVO based on checkbox (transient attribute) status before applying 'Exists' clause.
    Let me know, if I am in wrong process.
    Thanks in advance,
    Samba.

    Can some one suggest on our issue?
    Thanks,
    Samba.

Maybe you are looking for

  • How to connect my phone to macbook air for the call feature ?

    Hi, my macbook air, 2014 just upgraded to OS X Yosemite. My iPhone is the 5 version, iOS 8.02. I don't know how to connect my phone to the mac for the call feature. What should I do first? Thanks very much!

  • How to reinstall iWork '09 (part of Mac Box Set) after recalled mac hard drive was replaced?

    imac 27" late 2009 OSX 10.8.2 Have spent a week trying to get iwork opened ( use Pages for my business ) - read almost every support, tried all options to no avail - earlier restore using Time Machine after affected Seagate hard drive was replaced no

  • Mac Mini: Want to connect to Wi-Fi

    I have a older Mac Mini with a G4 processor.  It is not Wi-Fi capable (when I bought it Wi-Fi was not very popular).  I would like make it Wi-Fi capable.  I am going to give the Mini to my step daughter.  What would be the easiest way to connect the

  • Regarding Vendor Address

    HI All If there is a change in the vendor's address and i change the same in SAP. The changed address details also reflects in the existing documents which were created. But my requirement is documents which are created after the change of address sh

  • "Pop" - and then it sort of dies

    Hi - I was running my ibook G4 today when it suddenly died. It's about 2.5 years old, and has never presented any problems. On this occasion, I had only been using it for about 2 hours or so. I was running Quicktime and Firefox with an external hard