Query Plan changes with search criteria

Hi!
I have a query like below
SELECT x.id
from id_table x
,(select a.id
from text_table a
where a.p_date >= trunc(sysdate-1)
and a.p_date <= trunc(sysdate-1)
and a.p_time >= to_date('2012-05-30 00:00:00','YYYY-MM-DD HH24:MI:SS')
and a.p_time >= to_date('2012-05-30 12:20:47','YYYY-MM-DD HH24:MI:SS')
and contains(a.text, '(external)') > 0
) y
WHERE y.id = x.id
AND (x.build_x is null OR x.build_x in ('Y'))
id_table has an index on id
text_table is partitioned along p_date
id_table has 175M rows
text_table has 11K rows that match the criteria
when searching for "external" I get a full table scan on id_table
when searching for "extern" I get an indexed scan on id_table
when adding hint /*+ parallel (x,2) */ I get the indexed scan
I have done Gather Statistics on id_table with
opt_method => 'ALL INDEXED COLUMNS SIZE 254'
In other environments with id_table having about a 10th or the rows and text_table about half the results, I get an indexed scan on the id_table
Any ideas?

Hi!
I have a query like below
SELECT x.id
from id_table x
,(select a.id
from text_table a
where a.p_date >= trunc(sysdate-1)
and a.p_date <= trunc(sysdate-1)
and a.p_time >= to_date('2012-05-30 00:00:00','YYYY-MM-DD HH24:MI:SS')
and a.p_time >= to_date('2012-05-30 12:20:47','YYYY-MM-DD HH24:MI:SS')
and contains(a.text, '(external)') > 0
) y
WHERE y.id = x.id
AND (x.build_x is null OR x.build_x in ('Y'))
id_table has an index on id
text_table is partitioned along p_date
id_table has 175M rows
text_table has 11K rows that match the criteria
when searching for "external" I get a full table scan on id_table
when searching for "extern" I get an indexed scan on id_table
when adding hint /*+ parallel (x,2) */ I get the indexed scan
I have done Gather Statistics on id_table with
opt_method => 'ALL INDEXED COLUMNS SIZE 254'
In other environments with id_table having about a 10th or the rows and text_table about half the results, I get an indexed scan on the id_table
Any ideas?

Similar Messages

  • Unable to retrieve records with search criteria

    Hi All,
    I am trying to retrieve records based on search criteria as below, but not able to retrieve records.
    I created a search Search s=new Search(repSchema.getTableId("Customers"));
    Search s=new Search(repSchema.getTableId("Customers"));
              SearchGroup sg = new SearchGroup();
    FieldSearchDimension fsdCustFinValidated = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated")));
    BooleanSearchConstraint bSearchComm_Validated = new BooleanSearchConstraint(false);
    s.addSearchItem(fsdCustFinValidated, bSearchComm_Validated);
    s.setComparisonOperator(Search.AND_OPERATOR);     
    FieldSearchDimension fsdMaintableType = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Company_Type")));
    TextSearchConstraint tscCustType = new TextSearchConstraint("CUSTOMER", TextSearchConstraint.EQUALS);
    s.addSearchItem(fsdMaintableType, tscCustType);
    s.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate.add(Calendar.DATE,-6);
    System.out.println("customerCreditEscalation: calCreate:" + calCreate.getTime());
    FieldSearchDimension fsdMaintableDate = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated_Trigger")));
    SearchConstraint srchConstCreateGE = new DateTimeSearchConstraint(calCreate,DateTimeSearchConstraint.LESS_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate,srchConstCreateGE) ;
    sg.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate1 = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate1.add(Calendar.DATE,-7);
    SearchConstraint srchConstFinVldTrgrDate = new DateTimeSearchConstraint(calCreate1,DateTimeSearchConstraint.GREATER_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate, srchConstFinVldTrgrDate);
    s.addSearchItem(sg);
    Basically I am trying to search using A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group.
    Please let me know if I am doing anything wrong.
    Thanks
    -Sai

    Hi Greg,
    Thanks for the answer. I am trying to do a search as below.
    Earlier in the blog I mentoned A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group, but my search is
    A=a and B=b and (C=c and C=d) . C is the same dimension, which is a timestamp field.
    I am getting my results with A=a and B=b and C< c where C is Timestamp field. But my requirment is equal to a date older than two days. So when I try equal A=a and B=b and C=c  it is not working(may be because it is timestamp field and c is a calendar ). So I am trying to do A=a and B=b and (C<c and C>d) so that I get records that fall with in those days. So for (C<c and C>d) I am creating a search group and adding it to search which is not giving me the rows.
    Hope I explained it ok.
    If you know of any samples please let me know.
    Regards
    -Sai

  • How can I change the search criteria for Smart Folders?

    I have a saved search Smart Folder that I wish I to modify. How do I do that? (It currently searched for all .HDR files, but I need to to find only HDR images that are more than 1 month old)

    select the existing smart folder, click on the "gears" button in finder's toolbar and click on 'show search criteria". modify them and save.

  • Using "Restrict by app" in change query causes issues with Search Results

    Hello!
    I am hoping some experienced SP admin can help me out. I am having issues with the relevance ranking for my search results web part.
    I created a Wiki (OOTB) within a site collection and on the home page of the Wiki I was looking to apply a Search Box and Search Results web part for easy searching. I wanted to ensure the search results were restricted to the scope of the pages within the
    wiki. I did the following after adding the 2 web parts:
    Entered edit mode for the page
    Started to edit the Search Results web part
    Under Properties for Search Results clicked on "Change Query"
    Navigated to BASICS and clicked "Switch to Quick Mode"
    For Select Query, picked "Wiki (System)" option
    For Restrict by app, picked "Specify a URL" and input the wiki URL "http://webapp.com/sites/sitecollection/wiki"
    Click OK
    The web part has 6 automatic results when I hit the page. These are the only 6 pages in my wiki. When I search a word or title of a page, they are not ranked in order or relevance. The ordering is static to what was being shown before the search, but the
    keywords I'm searching are bold. With out the taking the steps above, I can easily search these pages and have them ranked appropriately so I'm not too sure what I'm doing wrong. 
    Other Details
    The pages have been crawled and can be searched from anywhere else in SP.
    I am only a site collection admin for this specific site collection.
    I other than the steps above, I have not made any changes or customization to the search web parts; they are both out of the box SP.
    The SP Farm admin we unable to pin point what the root cause is either.

    Hi Mikael,
    Sorry for the wait, I was unable to post pictures, which i felt would better describe my issue.
    Could you output the query template you are ending up with?
    If you can tell me how to accomplish this, then I can provide it. Please keep in mind that I am only a site collection admin.
    Also, is the ranking/sorting for your webpart set to ranking?
    When looking at the web part settings, I didn't see an option to modify the ranking. Unfortunately, some sites in my intranet are down now so I can't even double check. Once it's back up, I will verify this as well.
    And how do you know they are ranked incorrectly?
    I wanted to display an image showing what I meant by this. As the wiki is down, I'll do my best with words. When I visit the wiki home page, I already have the search and search results web parts there. Without searching anything, the search results
    web part displays 6 pages that are available in the wiki. When I search, I expect to see the most relevant result at the top. similar to the following: 
    *Search result from another section of the intranet site.*
    What I receive instead is the same list of wiki pages, in the same order. The most relevant result
    is not moved to the top like in the image above, but I can see that the word "rush" is highlighted in bold. I hope this helps.
    If you need more of a description, please let me know.
    Thank you

  • Query plan changes when query is used in CREATE TABLE AS

    We've puzzled by the fact that EXPLAIN PLAN gives a much different output for a SELECT statement than it does when the same statement is used for CREATE TABLE . . . AS SELECT.
    The bad part is that the CREATE TABLE version performs very badly, and that's what we want the query for.
    Why does this happen? Is there a difference (from the database's point of view) between retrieving a set of rows to display to the user and putting that same set into a new table? Doesn't this make it harder to diagnose and fix query performance problems?
    Here's our query:
    create table query_test AS
    select term, parentTerm, apidb.tab_to_string(cast(collect(trim(to_char(internal)))
                       as apidb.varchartab), ', ') as internal
                 from (
                     select distinct ga.organism as term,
                                     ga.species as parentTerm,
                                     tn.taxon_id as internal
                     from apidb.GeneAttributes ga, SRES.TaxonName tn, sres.Taxon t,
                          dots.AaSequence aas, dots.SecondaryStructure ss
                     where ga.organism = tn.name
               and tn.taxon_id = t.taxon_id
                       and t.taxon_id = aas.taxon_id
       and aas.aa_sequence_id = ss.aa_sequence_id
               and t.rank != 'species'
               union
                     select distinct ga.species as term,
                       '' as parentTerm,
                                     ts.taxon_id as internal
                     from apidb.GeneAttributes ga, SRES.TaxonName tn, apidb.taxonSpecies ts,
                          dots.aasequence aas, dots.SecondaryStructure ss
                     where ga.organism = tn.name
                      and tn.taxon_id = ts.taxon_id
                      and ts.taxon_id = aas.taxon_id
                     and aas.aa_sequence_id = ss.aa_sequence_id
       group by term,parentTerm;Without the CREATE TABLE, the plan looks like this:
    | Id  | Operation                             | Name                      | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | CREATE TABLE STATEMENT                |                           |  2911 |  5986K|       | 18840   (1)| 00:03:47 |
    |   1 |  LOAD AS SELECT                       | QUERY_TEST                |       |       |       |            |          |
    |   2 |   VIEW                                |                           |  2911 |  5986K|       | 18669   (1)| 00:03:45 |
    |   3 |    SORT GROUP BY                      |                           |  2911 |   332K|       | 18660   (1)| 00:03:44 |
    |   4 |     VIEW                              |                           |  2911 |   332K|       | 18659   (1)| 00:03:44 |
    |   5 |      SORT UNIQUE                      |                           |  2911 |   292K|       | 18659   (6)| 00:03:44 |
    |   6 |       UNION-ALL                       |                           |       |       |       |            |          |
    |*  7 |        HASH JOIN                      |                           |  2907 |   292K|  2160K| 17762   (1)| 00:03:34 |
    |   8 |         TABLE ACCESS FULL             | GENEATTRIBUTES10650       | 40957 |  1679K|       |   795   (1)| 00:00:10 |
    |*  9 |         HASH JOIN                     |                           | 53794 |  3204K|  1552K| 16675   (1)| 00:03:21 |
    |* 10 |          HASH JOIN                    |                           | 37802 |  1107K|       | 12326   (1)| 00:02:28 |
    |* 11 |           HASH JOIN                   |                           | 37945 |   629K|       | 10874   (1)| 00:02:11 |
    |  12 |            INDEX FAST FULL SCAN       | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|       |    33   (0)| 00:00:01 |
    |  13 |            INDEX FAST FULL SCAN       | AASEQUENCEIMP_REVIX6      |  7886K|    82M|       | 10816   (1)| 00:02:10 |
    |* 14 |           TABLE ACCESS FULL           | TAXON                     |   514K|  6530K|       |  1450   (1)| 00:00:18 |
    |  15 |          TABLE ACCESS FULL            | TAXONNAME                 |   760K|    22M|       |  2721   (1)| 00:00:33 |
    |* 16 |        HASH JOIN                      |                           |     4 |   380 |       |   886   (1)| 00:00:11 |
    |  17 |         NESTED LOOPS                  |                           |   730 | 64970 |       |   852   (1)| 00:00:11 |
    |* 18 |          HASH JOIN                    |                           |     1 |    78 |       |   847   (1)| 00:00:11 |
    |  19 |           NESTED LOOPS                |                           |       |       |       |            |          |
    |  20 |            NESTED LOOPS               |                           |    17 |   612 |       |    51   (0)| 00:00:01 |
    |  21 |             TABLE ACCESS FULL         | TAXONSPECIES10646         |    12 |    60 |       |     3   (0)| 00:00:01 |
    |* 22 |             INDEX RANGE SCAN          | TAXONNAME_IND01           |     1 |       |       |     2   (0)| 00:00:01 |
    |  23 |            TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |       |     4   (0)| 00:00:01 |
    |  24 |           TABLE ACCESS FULL           | GENEATTRIBUTES10650       | 40957 |  1679K|       |   795   (1)| 00:00:10 |
    |* 25 |          INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |   768 |  8448 |       |     5   (0)| 00:00:01 |
    |  26 |         INDEX FAST FULL SCAN          | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|       |    33   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       7 - access("GA"."ORGANISM"="TN"."NAME")
       9 - access("TN"."TAXON_ID"="T"."TAXON_ID")
      10 - access("T"."TAXON_ID"="TAXON_ID")
      11 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      14 - filter("T"."RANK"<>'species')
      16 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      18 - access("GA"."ORGANISM"="TN"."NAME")
      22 - access("TN"."TAXON_ID"="TS"."TAXON_ID")
      25 - access("TS"."TAXON_ID"="TAXON_ID")
    46 rows selected.With the CREATE TABLE, the plan for the SELECT alone looks like this:
    | Id  | Operation                           | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                    |                           |     2 |   234 |  1786   (1)| 00:00:22 |
    |   1 |  SORT GROUP BY                      |                           |     2 |   234 |  1786   (1)| 00:00:22 |
    |   2 |   VIEW                              |                           |     2 |   234 |  1785   (1)| 00:00:22 |
    |   3 |    SORT UNIQUE                      |                           |     2 |   198 |  1785  (48)| 00:00:22 |
    |   4 |     UNION-ALL                       |                           |       |       |            |          |
    |*  5 |      HASH JOIN                      |                           |     1 |   103 |   949   (1)| 00:00:12 |
    |   6 |       NESTED LOOPS                  |                           |   199 | 19303 |   915   (1)| 00:00:11 |
    |   7 |        NESTED LOOPS                 |                           |    13 |  1118 |   850   (1)| 00:00:11 |
    |   8 |         NESTED LOOPS                |                           |    13 |   949 |   824   (1)| 00:00:10 |
    |   9 |          VIEW                       | VW_DTP_E387155E           |    13 |   546 |   797   (1)| 00:00:10 |
    |  10 |           HASH UNIQUE               |                           |    13 |   546 |   797   (1)| 00:00:10 |
    |  11 |            TABLE ACCESS FULL        | GENEATTRIBUTES10650       | 40957 |  1679K|   795   (1)| 00:00:10 |
    |  12 |          TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |     3   (0)| 00:00:01 |
    |* 13 |           INDEX RANGE SCAN          | TAXONNAME_IND02           |     1 |       |     2   (0)| 00:00:01 |
    |* 14 |         TABLE ACCESS BY INDEX ROWID | TAXON                     |     1 |    13 |     2   (0)| 00:00:01 |
    |* 15 |          INDEX UNIQUE SCAN          | PK_TAXON                  |     1 |       |     1   (0)| 00:00:01 |
    |* 16 |        INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |    15 |   165 |     5   (0)| 00:00:01 |
    |  17 |       INDEX FAST FULL SCAN          | SECONDARYSTRUCTURE_REVIX9 | 37945 |   222K|    33   (0)| 00:00:01 |
    |  18 |      NESTED LOOPS                   |                           |     1 |    95 |   834   (1)| 00:00:11 |
    |  19 |       NESTED LOOPS                  |                           |     1 |    89 |   833   (1)| 00:00:10 |
    |* 20 |        HASH JOIN                    |                           |     1 |    78 |   828   (1)| 00:00:10 |
    |  21 |         NESTED LOOPS                |                           |       |       |            |          |
    |  22 |          NESTED LOOPS               |                           |    13 |   949 |   824   (1)| 00:00:10 |
    |  23 |           VIEW                      | VW_DTP_2AAE9FCE           |    13 |   546 |   797   (1)| 00:00:10 |
    |  24 |            HASH UNIQUE              |                           |    13 |   546 |   797   (1)| 00:00:10 |
    |  25 |             TABLE ACCESS FULL       | GENEATTRIBUTES10650       | 40957 |  1679K|   795   (1)| 00:00:10 |
    |* 26 |           INDEX RANGE SCAN          | TAXONNAME_IND02           |     1 |       |     2   (0)| 00:00:01 |
    |  27 |          TABLE ACCESS BY INDEX ROWID| TAXONNAME                 |     1 |    31 |     3   (0)| 00:00:01 |
    |  28 |         TABLE ACCESS FULL           | TAXONSPECIES10646         |    12 |    60 |     3   (0)| 00:00:01 |
    |* 29 |        INDEX RANGE SCAN             | AASEQUENCEIMP_REVIX6      |   768 |  8448 |     5   (0)| 00:00:01 |
    |* 30 |       INDEX RANGE SCAN              | SECONDARYSTRUCTURE_REVIX9 |     1 |     6 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
      13 - access("ITEM_1"="TN"."NAME")
      14 - filter("T"."RANK"<>'species')
      15 - access("TN"."TAXON_ID"="T"."TAXON_ID")
      16 - access("T"."TAXON_ID"="TAXON_ID")
      20 - access("TN"."TAXON_ID"="TS"."TAXON_ID")
      26 - access("ITEM_1"="TN"."NAME")
      29 - access("TS"."TAXON_ID"="TAXON_ID")
      30 - access("AA_SEQUENCE_ID"="SS"."AA_SEQUENCE_ID")
    50 rows selected.Edited by: JohnI on Jul 18, 2011 2:19 PM
    Edited by: JohnI on Jul 18, 2011 2:28 PM

    Charles Hooper wrote a series of blog entries on a similar topic some time ago: http://hoopercharles.wordpress.com/2010/12/15/select-statement-is-fast-insert-into-using-the-select-statement-is-brutally-slow-1/ (including a lot of useful comments) and two following articles. I have to confess that I did not read the posts again - but I think you will find some good ideas how to analyze the problem.
    Regards
    Martin Preiss

  • I can't locate the music genre of the artist I'm looking for, why have iTunes changed the search criteria making it much more difficult to find an artist?

    Is anyone else finding it difficult to locate an artist from the itunes store using the genre search? I've tried to locate 2 artists over the last couple of days and can't find them in any of the obvious genres. I contacted Itunes support and received a very unhelpful reply from someone who didn't even understand the problem I was having. Help!

    Yes, I just discovered the POWER SEARCH feature missing and had a mini-meltdown until I found the power search, using the STORE button on the main menu, I click "search" and the power search page pops back, so wharever idiot at Itunes thought it a good idea to delete Power search from the Itunes webpage needs a smack in the head, and put the power search feature back, duh.

  • Search criteria for insert/update bdoc

    Hi All,
    In our set up we have ecc to crm replication of BP. If one goes and checks the extension data of a stuck bdoc it has an Object Task- Insert or Update.
    Can someone help me with search criteria so that i can pull out bdocs which have an Insert as the Object task ??
    We have search criteria for errored/intermediate state bdocs; for inbound vs outbound; bdoc type etc etc..
    Need one based on Insert/Update Task so that any new data replication if stuck with its very first bdoc( Insert type) can be immediately queried.
    Regards
    Abhinav

    Hello Abhinav,
    I do not think that we have such a search criteria to search for BDocs based on the Task Type, which comes under the
    data part of the BDoc.
    One alternative way is to find out in which table these data gets stored and write a program to fetch the revelent Bdocs.
    Hope thisl helps!
    Best Regards,
    Shanthala Kudva

  • Get search criteria from query panel with table

    hi guys,
    i have a query panel with table that i created from a VO.
    i use the all queryable attribute in the generated DataControl.
    i hv a requirement to update the database value with the same search criteria with the query panel.
    but i want the submitted search criteria, not only written in the query panel criteria.
    i'm using JDEV & BPM 11.1.1.6
    i've already tried to get the criteria using
    QueryModel queryModel = getQueryPanel().getModel(); 
    QueryDescriptor queryDescriptor = queryModel.getSystemQueries().get(0);             
    ConjunctionCriterion cc = queryDescriptor.getConjunctionCriterion();
    for(int i=0;i<cc.getCriterionList().size();i++){
         AttributeCriterion ac = (AttributeCriterion)cc.getCriterionList().get(i);
         System.out.println("DEBUG LABEL : " + ac.getAttribute().getLabel());
         System.out.println("DEBUG VALUE : " + ac.getValues().get(0));    
    }        but it only get the value that filled in the search criteria input text, not the criteria that already been searched and viewed in the table
    my other question is, can i override the search button function ? so i can add a custom method to save the search criteria to my temporary variable.
    thanks
    Edited by: Juw on May 29, 2013 2:05 AM

    Is this https://blogs.oracle.com/jdevotnharvest/entry/how-to_tell_the_viewcriteria_a_user_chose_in_an_afquery_component or http://www.learnoracleadf.com/2013/05/programatic-handle-to-adf-query.html what you are looking for?
    Timo

  • How to change the view criteria at run time for af:query

    Hi,
    I've a usecase where I need to change the view criteria of the af:query at run time.
    Use case:
    =======
    1) Consider a check box (Show Emps Under Dept 10) in the query panel when user selects and clicks 'Search' button should show the employees under dept 10. If user searches without selecting the check box, the results should show all the employees in all the departments.
    2) I need to have a check box always in the query panel. Its mandatory.
    The way I implemented:
    ==============
    1) Created a transient variable 'Show Emps Under Dept 10' in the EmployeeVO and also created a bind variable bind_DeptNo.
    2) Create a view criteria 'AllEmployees' which has only the transient attribute as the view criteria item and whose value set to 'false' by default.
    3) Created another view criteria 'EmpUnderDept' which has 'DepartmentId' as the view criteria item and whose value set to the bind variable 'bind_DeptNo'.
    4) Dropped the view criteria 'EmpUnderDept' as the 'af:query' panel in the jspx page.
    5) Overridden the queryListener as '#{EmpBean.empSearch}'
    6) Has the below code in the empSearch method as below. When user selects the check box, applying the other criteria 'EmpUnderDept' and setting the bind variable to '10'.
    public void empSearch(QueryEvent queryEvent) {
    // Add event code here...
    QueryDescriptor queryDesc = (QueryDescriptor) queryEvent.getDescriptor();
    ConjunctionCriterion conCrit = queryDesc.getConjunctionCriterion();
    List<Criterion> criterionList = conCrit.getCriterionList();
    List criterionValues = new ArrayList();
    Object criteriaValue = null;
    int criteriaNo = 0;
    DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    for (Criterion criterion : criterionList) {
    AttributeDescriptor attrDescriptor = ((AttributeCriterion)criterion).getAttribute();
    System.out.println("============== attrDescriptor.getName() =================== " + attrDescriptor.getName());
    criteriaValue = ((AttributeCriterion)criterion).getValues().get(0);
    if(criteriaNo==0) {
    Boolean val = (Boolean) ((AttributeCriterion)criterion).getValues().get(0);
    if (val.equals(true)) {
    OperationBinding method = (OperationBinding) ADFUtil.findOperation("ExecuteWithParams");
    if(method!=null) {
    Map params = method.getParamsMap();
    //params.put(key, value)
    method.getParamsMap().put("bind_DeptId", 10L);
    method.execute();
    ADFUtil.invokeMethodExpression( "#{bindings.EmpUnderDeptCriteiaQuery.processQuery}", queryEvent);
    } else {
    //ADFUtil.invokeEL("#{bindings.ExecuteWithParams.execute}");
    ADFUtil.invokeMethodExpression( "#{bindings.AllEmployeesCriteriaQuery.processQuery}", queryEvent);
    But this approach is not working and its always showing all the employees in all the departments.
    Please let me know if there is a way to change the view criteria at run time depending on the values set at run time for one of the view criteria items.
    JDev version am using is '11.1.1.5'
    Thanks,
    Lakshman

    Hi Shay,
    It worked for me without overriding the executeQuery() method in the ViewImpl.java.
    Instead of creating 2 view criteria, I created only one which has both transient variable and the DepartmentId = <bind_DeptId>. With the above code, it worked properly. Now I am using only one view criteria.
    Thank you.

  • A search form with three search criterias

    I want to create a search form in Apex with three text boxes that would let us search with a lastName,firstName or a course Name. So i would have three text box regions where the user can enter any one of the search criterias and get a results
    the sql query that does the join is as
      select Student.Student_id, 
             Student.First_NAME, 
               Student.LAST_NAME,
             Student.Email1 as Primaryemail,
             Student.Email2 as SecondaryEmail,
             Student.Phone1 as MobileNumber, 
               Student.Phone2 as HomeNumber,
             Address.Street1 as Street ,
               Address.City as City,
               Address.State as State,
               Address.ZIP as Zip, 
               Course.PROVIDER_COURSE_ID as CourseID,
               Course.Course_Name as Course,
               Course.Credit_Hours as Credit_Hours,
               INSTITUTION.Name as InstName
      from Student Inner join Address on Student.ADDR_ID =  Address.ID
                   Inner Join Institution on Student.INST_ID = Institution.ID
                      Inner join Course on Course.INST_ID = Institution.IDand i want to incorporate my query into pl/sql example as below which is provide in apex examples as below where it searches for assignee and status. any ideas guys how i can do this or if there is simpler way to do this where the user can have three text boxes and search with their names or course name etc.
    declare
       c pls_integer := 0;
       l_detail varchar2(4000);
       i pls_integer;
       l pls_integer;
       l_max_rows    integer;
    begin
    l_max_rows := nvl(:P2_ROWS,10);
    if :P2_SEARCH is null
    and :P2_ASSIGNEE is null
    and :P2_STATUS is null then
       sys.htp.p('<p>'||
           apex_escape.html('Please enter at least one search condition.')||
           '</p>');
    else
      -- PUT YOUR QUERY HERE
      for c1 in (
      select id, project, task_name, start_date, end_date, status, assigned_to,
           cost, budget
      from EBA_DEMO_SEARCH_PROJECTS
      where (   instr(upper(assigned_to),upper(:P2_ASSIGNEE)) > 0
             or :P2_ASSIGNEE is null)
      and (   instr(upper(status),upper(:P2_STATUS)) > 0
           or :P2_STATUS is null)
      and (   instr(upper(project),upper(:P2_SEARCH)) > 0
           or instr(upper(task_name),upper(:P2_SEARCH)) > 0
           or instr(upper(status),upper(:P2_SEARCH)) > 0
           or instr(upper(assigned_to),upper(:P2_SEARCH)) > 0
           or :P2_SEARCH is null
      loop
        c := c + 1;
        if c = 1 then
           sys.htp.p('<ul class="sSearchResultsReport">');
        end if;
        sys.htp.p('<li>');
        sys.htp.prn('<span class="title">');
        -- DEFINE DRILL DOWN LINK HERE
        sys.htp.prn('<a href="'
          ||apex_util.prepare_url('f?p='||:APP_ID||':3:'||:APP_SESSION||
            ':::3:P3_ID:'||c1.id)||'">');
        -- ASSIGN PRIMAY ATTRIBUTE HERE, REFERENCE QUERY COLUMN
        l_detail := c1.project;
        i := instr(upper(l_detail),upper(:P2_SEARCH));
        if  i > 0 then
           l := length(:P2_SEARCH);
           l_detail := apex_escape.html(substr(l_detail,1,i-1))||
              '<span class="highlight">'||
              apex_escape.html(substr(l_detail,i,l))||'</span>'||
              apex_escape.html(substr(l_detail,i+l));
        end if;
        sys.htp.prn(l_detail);               
        sys.htp.prn('</a></span>');
        sys.htp.prn('<span class="description">');
        -- ASSIGN SECONDARY ATTRIBUTE HERE, REFERENCE QUERY COLUMN
        l_detail := c1.task_name;
        i := instr(upper(l_detail),upper(:P2_SEARCH));
        if  i > 0 then
           l := length(:P2_SEARCH);
           l_detail := apex_escape.html(substr(l_detail,1,i-1))||
              '<span class="highlight">'||
              apex_escape.html(substr(l_detail,i,l))||'</span>'||
              apex_escape.html(substr(l_detail,i+l));
        end if;
        sys.htp.prn(l_detail);
        sys.htp.prn('</span>');
        -- DEFINE ADDITIONAL QUERY COLUMNS FOR SEARCH BELOW
        sys.htp.p('<span class="type">');
        sys.htp.prn('Assigned to: ');
        sys.htp.prn(apex_escape.html(c1.assigned_to));
        sys.htp.prn('</span>');
        -- display additional column detail
        sys.htp.p('<br /><span class="type">');
        sys.htp.prn('Status: ');
        sys.htp.prn(apex_escape.html(c1.status));
        sys.htp.prn('</span>');
        sys.htp.prn('</li>');
        if c = l_max_rows then
           exit;
        end if;
      end loop;
      if c > 0 then
        sys.htp.p('</ul>');
        sys.htp.p('<p>'||c||' results found.</p>');
      else
        sys.htp.p('<p>No data found matching your search criteria.</p>');
      end if;
    end if;
    end;i tried to change the pl/sql to incorporate it into my apex application but i consistently get an error as pl/sql not defined.
    any help or a slight hint is very much appreciated
    thanks for looking and taking the time to read it through if u made it this far or even if u made it half way

    Thanks that worked and i got the procedure inside apex as well now i have to figure out how to make the search condition so that it will look for a like condition as well so the user can enter sam for samuel and still find the users
    declare
       c             pls_integer := 0;
       l_detail      varchar2(32767);
       i             pls_integer;
       l             pls_integer;
       l_max_rows    integer;
    begin
    l_max_rows := nvl(:P37_ROWS,10);
    if :P37_SEARCH is null
    and :P37_FirstName is null
    and :P37_LastName is null
    and :P37_Course_Name is null
    then
       sys.htp.p('<p>Please enter at least one search condition.</p>');
    else
      for c1 in (
    select
    /* SIMULATE A UNIQUE COLUMN */
             Student.Student_id || ',' || Course.Course_id as FAKE_PK,
    Student.Student_id , 
             Student.First_NAME as FirstName, 
               Student.LAST_NAME as LastName,
             Student.Email1 as Primaryemail,
             Student.Email2 as SecondaryEmail,
             Student.Phone1 as MobileNumber, 
               Student.Phone2 as HomeNumber,
             Address.Street1 as Street ,
               Address.City as City,
               Address.State as State,
               Address.ZIP as Zip, 
               Course.PROVIDER_COURSE_ID as CourseID,
               Course.Course_Name as Course_Name,
               Course.Credit_Hours as Credit_Hours,
               INSTITUTION.Name as InstName
      from Student left join Address on Student.ADDR_ID =  Address.ID
                   left Join Institution on Student.INST_ID = Institution.ID
                    left join Course on Course.INST_ID = Institution.ID
      where ( instr(upper(First_Name),upper(:P37_FirstName)) > 0
             or :P37_FirstName is null)
       and
              (instr(upper(Last_Name),upper(:P37_LastName)) > 0
             or :P37_LastName is null)
       and
                (instr(upper(Course_Name),upper(:P37_Course)) > 0
             or :P37_Course is null)
       and ( 
             instr(upper(First_Name),upper(:P37_SEARCH)) > 0
           or instr(upper(Last_Name),upper(:P37_SEARCH)) > 0
           or instr(upper(Course_Name),upper(:P37_SEARCH)) > 0
           or :P37_SEARCH is null
      order by Course_Name desc
      loop
        c := c + 1;
        if c = 1 then
           sys.htp.p('<ul class="sSearchResultsReport">');
        end if;
        sys.htp.p('<li>');
        l_detail := c1.Course_Name;
        i := instr(upper(l_detail),upper(:P37_SEARCH));
        if  i > 0 then
           l := length(:P37_SEARCH);
           l_detail := apex_escape.html(substr(l_detail,1,i-1))||
              '<span class="highlight">'||
              apex_escape.html(substr(l_detail,i,l))||'</span>'||
              apex_escape.html(substr(l_detail,i+l));
        end if;
        sys.htp.prn(l_detail);               
        sys.htp.prn('</a></span>');
        sys.htp.prn('<span class="description">');
        l_detail := c1.FirstName;
        i := instr(upper(l_detail),upper(:P37_SEARCH));
        if  i > 0 then
           l := length(:P37_SEARCH);
           l_detail := apex_escape.html(substr(l_detail,1,i-1))||
              '<span class="highlight">'||
              apex_escape.html(substr(l_detail,i,l))||'</span>'||
              apex_escape.html(substr(l_detail,i+l));
        end if;
        sys.htp.prn(l_detail);
        sys.htp.prn('</span>');
        sys.htp.prn('<span class="type">Incident: ');
        sys.htp.prn(apex_escape.html(c1.FirstName));
        sys.htp.prn('</span>');
        sys.htp.p('</li>');
        if c = l_max_rows then
           exit;
        end if;
      end loop;
      if c > 0 then
        sys.htp.p('</ul>');
        sys.htp.p('<p>'||c||' results found.</p>');
      else
        sys.htp.p('<p>No search results.</p>');
      end if;
    end if;
    end;  Edited by: user13133295 on Jun 4, 2013 1:59 PM

  • Performance problem: Query explain plan changes in pl/sql vs. literal args

    I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
    select * from largeTable large
    join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
    join...(other aux tables)
    where large.pk_id between 123 and 456;
    Its performance was excellent with literal arguments (1 sec per execution).
    But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
    Ex:
    CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
    CURSOR LT_CURSOR IS
    select * from largeTable large
    join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
    join...(other aux tables)
    where large.pk_id between param1 AND param2;
    BEGIN
    FOR aRecord IN LT_CURSOR
    LOOP
    (print timestamp...)
    END LOOP;
    END runQuery;
    Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
    Solution:
    Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
    Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
    Downside: Query not cached for future use. Perfectly fine for this query's purpose.
    Other suggestions are welcome.

    AmandaSoosai wrote:
    I have a complex query with 5+ table joins on large (million+ row) tables. In it's most simplified form, it's essentially
    select * from largeTable large
    join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
    join...(other aux tables)
    where large.pk_id between 123 and 456;
    Its performance was excellent with literal arguments (1 sec per execution).
    But, when I used pl/sql bind argument variables instead of 123 and 456 as literals, the explain plan changes drastically, and runs 10+ minutes.
    Ex:
    CREATE PROCEDURE runQuery(param1 INTEGER, param2 INTEGER){
    CURSOR LT_CURSOR IS
    select * from largeTable large
    join anotherLargeTable anothr on (anothr.id_2 = large.pk_id)
    join...(other aux tables)
    where large.pk_id between param1 AND param2;
    BEGIN
    FOR aRecord IN LT_CURSOR
    LOOP
    (print timestamp...)
    END LOOP;
    END runQuery;
    Rewriting the query 5 different ways was unfruitful. DB hints were also unfruitful in this particular case. LargeTable.pk_id was an indexed field as were all other join fields.
    Solution:
    Lacking other options, I wrote a literal query that concatenated the variable args. Open a cursor for the literal query.
    Upside: It changed the explain plan to the only really fast option and performed at 1 second instead of 10mins.
    Downside: Query not cached for future use. Perfectly fine for this query's purpose.
    Other suggestions are welcome.Best wild guess based on what you've posted is a bind variable mismatch (your column is declared as a NUMBER data type and your bind variable is declared as a VARCHAR for example). Unless you have histograms on the columns in question ... which, if you're using bind variables is usually a really bad idea.
    A basic illustration of my guess
    http://blogs.oracle.com/optimizer/entry/how_do_i_get_sql_executed_from_an_application_to_uses_the_same_execution_plan_i_get_from_sqlplus

  • ADF 11g - Query Component - How to set default values for search criteria

    I have defined a VO with named query (with 2 search criteria). I created a page and drop a query with table. It works just fine until this point. My requirement is to set a default values for the two search criteria. For example, I have release and category criteria where they are set to use a drop down. I would like to default the values for the drop down when the page is shown up the first time and query the result right away. Is there a way declaratively or I have to create a custom query?
    Thanks.

    I figured this out. Thanks.

  • Query Region (autoCustomizationCriteria) search criteria issue

    Hi All,
    In my search page I have used a Query Region with Construction Mode as autoCustomizationCriteria. Fot this regionin in Simple search panel I have 3 dropdowns and 2 Date Fields(OAMessageDateFieldBean) which in turn are mapped with related simpleSearchMappings fields.
    On this page , for search result table as table actions i have a create button which transfers me to create page. On create page I have the same dropdowns and date fields which are there on search page as search criteria.
    Now when i create a record , on click of create button records gets created and controls returns back to the search page with this newly created record in the search result table.(by default whenever search page is rendered it shows all records)
    The problem here is the search criteria dropdown and date fields gets populated with the values with which a new record was created .
    Why these values are getting populated as the page is difference and whenever the VO is querried I am already clearing its cache?
    Any suggestions regarding this ?
    Thanks and Regards,
    Anant Nimbalkar.

    Hi RamKumar,
    I have tried not to retain the AM and it worked but now there is a different problem.
    On create page on click of save button the record gets saved and related message is displayed on search page. (Used to work before i made retail AM flag false)
    But now as i have set it to false I am unable to show these messages on the Search page .
    Any idea how both these things ie dropdown with no values(on search page) and message can be achieved ?
    Thanks and Regards,
    Anant Nimbalkar.

  • SQ01 query on LDB BRF with selection criteria on BSEG

    Dear all,
    we built an inofset on LDB BRF (BKPF - BSEG) and a query with selection criteria based on both BKPF and BSEG tables.
    My proble : when the query select a posting fullfilling header data selection criteria but not line item criteria, it still displayed the header data in the layout.
    We set up a filter on the account to hide results where account is blank but we loss the filter exporting the result on access. So if anyome has a better idea, we'll be very thankfull.
    Br,

    Hi Rick,
    What Edan proposed will work as logical AND (both filters on dates will be checked simultaneously).
    Here is a solution.
    You’ll have a user entry variable on 0CALDAY.
    - Create a new variable on 0CALDAY, customer exit, mandatory, not ready for input. This variable should return the date entered in user entry variable.
    - Create a structure in columns.
    - New selection (let’s name it chg). Put there your KF and your Change date char. Restrict it by the user entry var. Hide it.
    - New selection (let’s name it crt). Put there your KF and your Created on date char. Restrict it by the customer exit var. Hide it.
    New formula (let’s name it FilteredAmount):
    ( 'chg' <> 0 ) * 'chg' + ( 'crt' <> 0 ) * 'crt'
    Create a condition:
    FilteredAmount <> 0.
    Best regards,
    Eugene

  • Change the default search criteria in CMD-F

    When you enter CMD-F from a Finder window, the default search criteria that come up is "Kind" is "Any".  This is probably the most useless search criterion I can imagine.  It is always necessary to add more criteria to get a minimally useful search under way. 
    Can anyone point me to a source I could use to change this default?  In my case, the most common and useful starting point would be "Filename"  Contains, and then a blank field into which I could enter a string that might be all or part of a filename.
    Thanks.

    I don't know how to change the default, but you can set up any number of starting points for searches like this:
    Enter Command-F in a Finder window, then set the criteria Filename and Contains. Click the Save lozenge.
    In the Save dialog, you will have the option of saving this search to the Finder Sidebar in addition to the default ~/Library/Saved Searches. Click on Smart icon in the Sidebar and a new Finder Search tab will open with your parameters set.
    If you don't want to save this search in your Sidebar, you can command-drag its smart folder from ~/Library/Saved Searches to the Finder Toolbar. Clicking on that will bring up a Finder Search with your parameters, as well.

Maybe you are looking for

  • Can i sync my iphone with more than one itunes library without erasing content?

    So i just got a replacement iphone yesterday, and restored from a backup all my contacts and stuff. I dont have my own laptop so when it comes to music i get all of my mine from other computers...this has never been a problem with my phone or ipods,

  • How to Get checkbox value when List value changed in classic report

    hi , i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list take value of checkbox item and show it in message . SQL for report SELECT '

  • Hard drive and RAM upgrade

    Hi I would like to know what are the maximum upgrades I can have on my laptop in RAM, hard drive and if possible processor. It is a HP pavilion dv8219ea with a Hewlett-Packard 30A6 56.24 board. Can you let me know the size and speed of both the RAM

  • Import from PPT error

    When trying to import a PPT file into Captivate 8 I recieve the following error "Unable to import Microsoft PowerPoint presentation. The file may be damaged." So far I have tried to import different ppt files and I still get the same error. Any ideas

  • Sybase ASE 15.7.0 in suspect status

    Hi Gurus, We have a problem when we try to connect to a SyBase DB (Adaptive Server Enterprise/15.7.0/EBF 20953 SMP ESD#4.2), the database is in suspect mode. We ran the following commands after rebooting but the same error appears: server>isql -X -Us