One-time Where clause

Hi,
I read about the one-time where clause from oracle9i docs.I understand that it can be used as an alternative to a pre-query trigger.
If this property is set at the runtime, in what trigger it has to be set using set_block_property? And how is the built-in referenced?
Or is it something which happens in the background?
Thanks
Sheba

Sheba,
check the online help for set_block_property --> Onetime Where Property. It provides examples too.
Frank

Similar Messages

  • Problem with one time where clause

    Hi All,
    I am working with Oracle Forms 10g.
    I have developed A new custom with Find window in that form. When we open the form First the find window will come first, and i have 10 fields in that form. For example PO number, supplier name,supplier site etc. When the user give po number and click find button in the find window it will move to my main form and query that po. If the user simply click find button all the po will listed. If the user give the supplier name alone and click find it will open the main form and query that supplier listed po alone. All working fine.
    Now i need to refresh the my page when it moves from find window to my main window. So i use Execute_query built in.But when i use Execute_query when i give single po alone and click find it querying all the po in my custom table. So i used onetime_where clause.
    But i dont know How to give more than one field in the onetime_where clause.
    This is my syntax and its not working in my scenario
    set_block_property('QUERY_FIND_BLK',ONETIME_WHERE,'C_PO_NUMBER='||:QUERY_FIND_BLK.C_PO_NUMBER);
    go_block('BANK_GUARANTEE_BLK');
    execute_query;
    So i tried by different
    set_block_property('QUERY_FIND_BLK',ONETIME_WHERE,
    'C_PO_NUMBER || C_PROJECT_ID || C_SUPPLIER_NAME || C_SUPPLIER_SITE_NAME || C_GUARANTEE_NUMBER
    || C_APPROVAL_STATUS || C_BG_TYPE AND C_BANK_NAME || C_BANK_BRANCH_NAME || C_GUAR_ISSUE_DATE || C_GUAR_ISSUE_DATE='
    || nvl(:QUERY_FIND_BLK.C_PO_NUMBER , :QUERY_FIND_BLK.C_PO_NUMBER )
    || nvl(:QUERY_FIND_BLK.C_PROJECT_NAME,:QUERY_FIND_BLK.C_PROJECT_NAME)
    || nvl(:QUERY_FIND_BLK.C_SUPPLIER_SITE,:QUERY_FIND_BLK.C_SUPPLIER_SITE)
    || nvl(:QUERY_FIND_BLK.C_SUPPLIER_SITE,:QUERY_FIND_BLK.C_SUPPLIER_SITE)
    || nvl(:QUERY_FIND_BLK.C_GUARANTEE_NO,:QUERY_FIND_BLK.C_GUARANTEE_NO)
    || nvl(:QUERY_FIND_BLK.C_APPROVAL_STATUS,:QUERY_FIND_BLK.C_APPROVAL_STATUS)
    || nvl(:QUERY_FIND_BLK.C_GUARANTEE_TYPE,:QUERY_FIND_BLK.C_GUARANTEE_TYPE)
    || nvl(:QUERY_FIND_BLK.C_BANK_NAME,:QUERY_FIND_BLK.C_BANK_NAME)
    || nvl(:QUERY_FIND_BLK.C_BRANCH_NAME,:QUERY_FIND_BLK.C_BRANCH_NAME)
    || nvl(:QUERY_FIND_BLK.C_FROM_DATE,:QUERY_FIND_BLK.C_FROM_DATE)
    || nvl(:QUERY_FIND_BLK.C_TO_DATE,:QUERY_FIND_BLK.C_TO_DATE));
    go_block('BANK_GUARANTEE_BLK');
    execute_query;
    But now again its querying all the records when i give a single po number in the query window.
    Can any one tell that how to use this onetime_where clause with multiple parameter
    Regards
    Srikkanth

    Hi Srikkanth,
    Try out below logic.
    PROCEDURE FIND_DETAILS IS
    V_WHERE VARCHAR2(2000);
    BEGIN
    V_WHERE := ' 1=1 ';
    IF :FIND_BLK.JOB_NUMBER IS NOT NULL THEN
    V_WHERE := V_WHERE || ' AND UPPER(JOB_NAME) LIKE '''||UPPER(:FIND_BLK.JOB_NUMBER) ||'''';
    END IF;
    IF :FIND_BLK.JOB_STATUS IS NOT NULL THEN
    V_WHERE := V_WHERE || ' AND STATUS_TYPE IN (SELECT lookup_code FROM mfg_lookups
    WHERE lookup_type = ''WIP_JOB_STATUS''
    AND UPPER(meaning) LIKE '''||UPPER(:FIND_BLK.JOB_STATUS)||''')';
    END IF;
    IF :FIND_BLK.WIP_CLASS IS NOT NULL THEN
    V_WHERE := V_WHERE || ' AND UPPER(WIP_CLASS_CODE) LIKE '''||UPPER(:FIND_BLK.WIP_CLASS)||'''';
    END IF;
    IF :FIND_BLK.ORG_CODE IS NOT NULL THEN
    V_WHERE := V_WHERE || ' AND ORG_ID = ' || :FIND_BLK.ORGANIZATION_ID;
    END IF;
    SET_BLOCK_PROPERTY('BLOCK_NAME',DEFAULT_WHERE,V_WHERE);
    GO_BLOCK('BLOCK_NAME');
    EXECUTE_QUERY;
    EXCEPTION
    WHEN OTHERS THEN
    FND_MESSAGE.SET_STRING('Unable to Match Search Criteria');
    FND_MESSAGE.SHOW;
    END;
    By using above where clause you can also do wild search e.g. C_PO_NUMBER like '%323' etc.
    Regards,
    Nisarg

  • How to call a form with dabble clicking on a record with one time where

    Hi All,
    How to call a form with dabble clicking on a record with one time where clause. I mean when i dabble click on the current record i want to call another form with details of the
    record with onetime where clause. Can anyone help me in this regard.
    Now i am calling a form with parameter with onetime where but this should avoid.
    Thanks in advance
    Arif

    Hello,
    I mistakenly mark it as solved. There is a problem remain. when i placed the code below it do not execute with the where condition. I mean the condition to execute is not work.
    All records executes. Please correct my code--
    Here the WHEN-BUTTON-PRESSED-trigger on the Edit-Button:
    :GLOBAL.MODE:='EDIT';
    :GLOBAL.REQ_ID:=:PROBLEM_REQUEST.REQ_ID;
    CALL_FORM('REQUEST_ID_PARAM',NO_HIDE,DO_REPLACE,NO_QUERY_ONLY);And also, WHEN-NEW-FORM-INSTANCE-trigger of REQUEST_ID_PARAM:
    DEFAULT_VALUE(NULL, 'GLOBAL.MODE');
    DEFAULT_VALUE(NULL, 'GLOBAL.REQ_ID');
    IF :GLOBAL.MODE='EDIT' THEN
    GO_BLOCK('PROBLEM_REQUEST');
    EXECUTE_QUERY;
    SET_BLOCK_PROPERTY('PROBLEM_REQUEST', INSERT_ALLOWED, PROPERTY_FALSE);
    END IF;Arif

  • How to set the where clause of a value set on the basis of a form field

    I am using a DFF(Descriptive FlexField), which needs to display the value of a certain column(say columnA) on the basis of the value of another column(say columnB).
    So i have created a value set which points to the table which has both these columns, and the DFF uses this value set. However, the problem is that I have not put any where clause in the value set, because of which i cannot handle the exact fetch returns more than one rows error.
    The query has to be as follows:
    select ColumnA from tbl where ColumnB = [ a form value ];
    What I want to know is how can i get the value of a certain field of a certain block of the form in the above query.
    Edited by: 981615 on Jan 14, 2013 12:48 AM
    Edited by: 981615 on Jan 14, 2013 12:48 AM

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • VPD - How to make the where clause a correlated query

    Hi,
    My VPD function has the following where clause:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    The problem is that the subquery is not using the unique key defined on the table pa_project_classes. What I need is something as follows:
    where_clause:= ' project_id in (select object_id from pa_project_classes p'||
    ' where p.class_category='||''''||l_cat||''''||
    ' and p.CLASS_CODE='||''''||l_class||''''||
    ' and p.OBJECT_TYPE=''PA_PROJECTS'''||
    ' and p.object_id=mainquery.project_id ||
    The problem is that since the table pa_project_classes also has a column project_id, I have to prefix the column name by the alias of the main query like 'mainquery.project_id'. However this seems impossible as main query is not unknown .
    I would be grateful if you could suggest any workaround or solution.
    Thanks

    Just have a look over these two statements if it solves your problem
    one time where clause
    Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
    dynamic where clause
    set_block_property('BLOCK_NAME'default_where, your form itme)
    you can where clause at run time from any procedure or some triggers

  • How to use alias name in where clause

    Hello,
    DECODE (item.inv_type,'OT', (DECODE (item.attribute2, 'STONE', 0, xfer.release_quantity1 * xfer.attribute10)
    'FG', (xfer.release_quantity1 * xfer.attribute10)
    ) matl_val
    In the above code matl_val is alias name i need to use that one in where clause as
    where matl_val > 0
    is this possible or anyother way can anyone help me.

    But the point is as you haven't read the documentation you may miss some valuable points about alias and will soon end with another problem.
    >
    Specify an alias for the column expression. Oracle Database will use this alias in the column heading of the result set. The AS keyword is optional. The alias effectively renames the select list item for the duration of the query. The alias can be used in the order_by_clause but not other clauses in the query.
    >
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_10002.htm#SQLRF01702

  • JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time

    Hi,
    I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
    My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
    public void populateOSTable(int P_EmpId)
    String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
    String m_OrderBy = "EmpView.EMP_NAME";
    oracle.jbo.ApplicationModule appModule = null;
    ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
    vo.setWhereClause(m_whereString);
    vo.setOrderByClause(m_OrderBy);
    vo.executeQuery();
    vo.next();
    String empName numAttrs = vo.getAttribute(EmpName);
    System.out.println(empName);
    Thanks.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
    Here is how I have usually done mine:
    1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
    2. Use a custom web bean to process the results of the query (print to HTML).
    for example:
    <jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
    <%
    // get the parameter from the find form
    String p = request.getParameter("p");
    String s = request.getParameter("s");
    // store the information for reference later
    session.putValue("p", p);
    session.putValue("s", s);
    // initialize the app module and view object
    rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
    // set the where clause string
    String theclause = "presname = '" + p + "' AND slideno=" + s;
    // set the where clause for the VO
    rsn.getRowSet().getViewObject().setWhereClause(theclause);
    rsn.getRowSet().getViewObject().executeQuery();
    rsn.getRowSet().first();
    %>
    </jsp:useBean>
    <jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
    <%
    // initialize the app module and VO
    wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
    wtb.render();
    %>
    In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
    Hope this helps.
    </jsp:useBean><HR></BLOCKQUOTE>
    Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
    Nathalie
    null

  • Where clause one query not being pushed down

    I am having a problem where I cannot get a certain "optional" parameter to be pushed down to a query. The parameter gets applied in memory after the result set is returned but not pushed down to the DB. The function is as follows:
    declare function getFoo($key as xs:string, $optinalInput as xs:string*) as element(b:bar)*
    for $foo in f:getFoo()
    where $key = $foo/key
    where not(exists($optinalInput)) or $foo/optional = $optinalInput<- does not get pushed down to the query
    return $foo
    If I make optinalInput an xs:string instead of xs:string * and the optional parameter will get pushed to the query. The problem is for this optional parameter I could get anywhere from 0-50 in the sequence. Seems like when the parameter is a sequence it doesn't get applied to the query. Is there any way around this?

    Mike,
    I understand the difference between * and ? and I was one of the people working on the "string-length not getting pushed" problem so I am very familiar with it. I tried you solution that you mentioned below and it still did not push the where clause to the query. I know I could achieve this with an ad-hoc query but I wanted to do a pure xquery implementation of this component because of the benefits it could have when interacting with other components in our ODSI project...such as SQL joining and potentially pushing additional where clause down from components that call this component. The only way I did get this to kind of work is to do this:
    return
    for $o in $optinalInput
    for $foo in f:getFoo()
    where $key = $foo/key
    where $o = $foo/optional
    return
    $foo
    for $count in 1
    where not(exists($optinalInput))
    for $foo in f:getFoo()
    where $key = $foo/key
    return
    $foo
    By putting the optional parameter into a FOR statement above the table call it guarantees that at least one will exists and that's why the optional parameter gets pushed properly to the DB with a parameterized query. The problem with this is that even though a parameterized query gets pushed it will call the SQL statement multiple times!...not good.
    Another solution that was suggested to me would be to create the number of sequences for each item in the sequence and treat each item as it's own. For example if you know that the schema limits the sequence from 0..50 then you could make 50 items and 50 where clauses....probably not an optimal solution either but it would achieve properly pushing the where clause tot he DB.
    For now I am satisfied with this optional parameter not being pushed to the DB because the performance was still good but it would be nice if there was a maintainable pure xquery solution to this problem.
    Thanks for the help it's always appreciated!
    Mike

  • Response time of query utterly upside down because of small where clause change

    Hello,
    I'm wondering why a small change on a where clause in a query has a dramatic impact on its response time.
    Here is the query, with its plan and a few details:
    select * from (
    SELECT xyz_id, time_oper, ...
         FROM (SELECT 
                        d.xyz_id xyz_id,
                        TO_CHAR (di.time_operation, 'DD/MM/YYYY') time_oper,
                        di.time_operation time_operation,
                        UPPER (d.delivery_name || ' ' || d.delivery_firstname) custname,
                        d.ticket_language ticket_language, d.payed,
                        dsum.delivery_mode delivery_mode,
                        d.station_delivery station_delivery,
                        d.total_price total_price, d.crm_cust_id custid,
                        d.bene_cust_id person_id, d.xyz_num, dpe.ers_pnr ers_pnr,
                        d.delivery_name,
                        TO_CHAR (dsum.first_travel_date, 'DD/MM/YYYY') first_traveldate,
                        d.crm_company custtype, UPPER (d.client_name) partyname,
                        getremark(d.xyz_num) remark,
                        d.client_app, di.work_unit, di.account_unit,
                        di.distrib_code,
                        UPPER (d.crm_name || ' ' || d.crm_firstname) crm_custname,
                       getspecialproduct(di.xyz_id) specialproduct
                   FROM xyz d, xyz_info di, xyz_pnr_ers dpe, xyz_summary dsum
                  WHERE d.cancel_state = 'N'
                 -- AND d.payed = 'N'
                    AND dsum.delivery_mode NOT IN ('DD')
                    AND dsum.payment_method NOT IN ('AC', 'AG')
                    AND d.xyz_blocked IS NULL
                    AND di.xyz_id = d.xyz_id
                    AND di.operation = 'CREATE'
                    AND dpe.xyz_id(+) = d.xyz_id
                    AND EXISTS (SELECT 1
                                  FROM xyz_ticket dt
                                 WHERE dt.xyz_id = d.xyz_id)
                    AND dsum.xyz_id = di.xyz_id
               ORDER BY di.time_operation DESC)
        WHERE ROWNUM < 1002
    ) view
    WHERE view.DISTRIB_CODE in ('NS') AND view.TIME_OPERATION > TO_DATE('20/5/2013', 'dd/MM/yyyy')
    plan with "d.payed = 'N'" (no rows, *extremely* slow):
    | Id  | Operation                          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                  |  1001 |  4166K| 39354   (1)| 00:02:59 |
    |*  1 |  VIEW                              |                  |  1001 |  4166K| 39354   (1)| 00:02:59 |
    |*  2 |   COUNT STOPKEY                    |                  |       |       |            |          |
    |   3 |    VIEW                            |                  |  1001 |  4166K| 39354   (1)| 00:02:59 |
    |   4 |     NESTED LOOPS OUTER             |                  |  1001 |   130K| 39354   (1)| 00:02:59 |
    |   5 |      NESTED LOOPS SEMI             |                  |   970 |   111K| 36747   (1)| 00:02:47 |
    |   6 |       NESTED LOOPS                 |                  |   970 |   104K| 34803   (1)| 00:02:39 |
    |   7 |        NESTED LOOPS                |                  |   970 | 54320 | 32857   (1)| 00:02:30 |
    |*  8 |         TABLE ACCESS BY INDEX ROWID| XYZ_INFO         |    19M|   704M| 28886   (1)| 00:02:12 |
    |   9 |          INDEX FULL SCAN DESCENDING| DNIN_IDX_NI5     | 36967 |       |   296   (2)| 00:00:02 |
    |* 10 |         TABLE ACCESS BY INDEX ROWID| XYZ_SUMMARY      |     1 |    19 |     2   (0)| 00:00:01 |
    |* 11 |          INDEX UNIQUE SCAN         | SB11_DSMM_XYZ_UK |     1 |       |     1   (0)| 00:00:01 |
    |* 12 |        TABLE ACCESS BY INDEX ROWID | XYZ              |     1 |    54 |     2   (0)| 00:00:01 |
    |* 13 |         INDEX UNIQUE SCAN          | XYZ_PK           |     1 |       |     1   (0)| 00:00:01 |
    |* 14 |       INDEX RANGE SCAN             | DNTI_NI1         |    32M|   249M|     2   (0)| 00:00:01 |
    |  15 |      TABLE ACCESS BY INDEX ROWID   | XYZ_PNR_ERS      |     1 |    15 |     4   (0)| 00:00:01 |
    |* 16 |       INDEX RANGE SCAN             | DNPE_XYZ         |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      1 - filter("DISTRIB_CODE"='NS' AND "TIME_OPERATION">TO_DATE(' 2013-05-20', 'syyyy-mm-dd'))
      2 - filter(ROWNUM<1002)
      8 - filter("DI"."OPERATION"='CREATE')
    10 - filter("DSUM"."DELIVERY_MODE"<>'DD' AND "DSUM"."PAYMENT_METHOD"<>'AC' AND "DSUM"."PAYMENT_METHOD"<>'AG')
    11 - access("DSUM"."XYZ_ID"="DI"."XYZ_ID")
    12 - filter("D"."PAYED"='N' AND "D"."XYZ_BLOCKED" IS NULL AND "D"."CANCEL_STATE"='N')
                  ^^^^^^^^^^^^^^
    13 - access("DI"."XYZ_ID"="D"."XYZ_ID")
    14 - access("DT"."XYZ_ID"="D"."XYZ_ID")
    16 - access("DPE"."XYZ_ID"(+)="D"."XYZ_ID")
    plan with "d.payed = 'N'" (+/- 450 rows, less than two minutes):
    | Id  | Operation                          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                  |  1001 |  4166K| 58604   (1)| 00:04:27 |
    |*  1 |  VIEW                              |                  |  1001 |  4166K| 58604   (1)| 00:04:27 |
    |*  2 |   COUNT STOPKEY                    |                  |       |       |            |          |
    |   3 |    VIEW                            |                  |  1002 |  4170K| 58604   (1)| 00:04:27 |
    |   4 |     NESTED LOOPS OUTER             |                  |  1002 |   130K| 58604   (1)| 00:04:27 |
    |   5 |      NESTED LOOPS SEMI             |                  |  1002 |   115K| 55911   (1)| 00:04:14 |
    |   6 |       NESTED LOOPS                 |                  |  1476 |   158K| 52952   (1)| 00:04:01 |
    |   7 |        NESTED LOOPS                |                  |  1476 | 82656 | 49992   (1)| 00:03:48 |
    |*  8 |         TABLE ACCESS BY INDEX ROWID| XYZ_INFO         |    19M|   704M| 43948   (1)| 00:03:20 |
    |   9 |          INDEX FULL SCAN DESCENDING| DNIN_IDX_NI5     | 56244 |       |   449   (1)| 00:00:03 |
    |* 10 |         TABLE ACCESS BY INDEX ROWID| XYZ_SUMMARY      |     1 |    19 |     2   (0)| 00:00:01 |
    |* 11 |          INDEX UNIQUE SCAN         | AAAA_DSMM_XYZ_UK |     1 |       |     1   (0)| 00:00:01 |
    |* 12 |        TABLE ACCESS BY INDEX ROWID | XYZ              |     1 |    54 |     2   (0)| 00:00:01 |
    |* 13 |         INDEX UNIQUE SCAN          | XYZ_PK           |     1 |       |     1   (0)| 00:00:01 |
    |* 14 |       INDEX RANGE SCAN             | DNTI_NI1         |    22M|   168M|     2   (0)| 00:00:01 |
    |  15 |      TABLE ACCESS BY INDEX ROWID   | XYZ_PNR_ERS      |     1 |    15 |     4   (0)| 00:00:01 |
    |* 16 |       INDEX RANGE SCAN             | DNPE_XYZ         |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("DISTRIB_CODE"='NS' AND "TIME_OPERATION">TO_DATE(' 2013-05-20', 'syyyy-mm-dd'))
       2 - filter(ROWNUM<1002)
       8 - filter("DI"."OPERATION"='CREATE')
      10 - filter("DSUM"."DELIVERY_MODE"<>'DD' AND "DSUM"."PAYMENT_METHOD"<>'AC' AND "DSUM"."PAYMENT_METHOD"<>'AG')
      11 - access("DSUM"."XYZ_ID"="DI"."XYZ_ID")
      12 - filter("D"."XYZ_BLOCKED" IS NULL AND "D"."CANCEL_STATE"='N')
      13 - access("DI"."XYZ_ID"="D"."XYZ_ID")
      14 - access("DT"."XYZ_ID"="D"."XYZ_ID")
      16 - access("DPE"."XYZ_ID"(+)="D"."XYZ_ID")
    XYZ.PAYED values breakdown:
    P   COUNT(1)
    Y   12202716
    N    9430207
    tables nb of records:
    TABLE_NAME           NUM_ROWS
    XYZ                  21606776
    XYZ_INFO            186301951
    XYZ_PNR_ERS           9716471
    XYZ_SUMMARY          21616607
    Everything that comes inside the "select * from(...) view" parentheses is defined in a view. We've noticed that the line "AND d.payed = 'N'" (commented above) is the guilty clause: the query takes one or two seconds to return between 400 and 500 rows if this line is removed, when included in the query, the response time then switches to *hours* -sic !- but then the result set is empty (no rows returned). The plan is exactly the same whether this "d.payed = 'N'" is added or removed, I mean the nb of steps, access paths, join order etc., only the rows/bytes/cost columns values change, as you can see.
    We've found no other way of solving this perf issue but by taking out this "d.payed = 'N'" condition and setting it outside the view along with view.DISTRIB_CODE and view.TIME_OPERATION.
    But we would like to understand why such a small change on the XYZ.PAYED column turns everything upside down that much, and we'd like to be able to tell the optimizer to perform this check on payed = 'N' by itself in the end, just like we did, through the use of a hint if possible...
    Anybody ever encountered such a behaviour before ? Do you have any advice regarding the use of a hint to reach the same response time as that we've got by setting the payed = N condition outside of the view definition ??
    Thanks a lot in advance.
    Regards,
    Seb

    I am really sorry I couldn't get back earlier to this forum...
    Thanks to you all for your answers.
    First I'd just like to correct a small mistake I made, when writing
    "the query takes one or two seconds": I meant one or 2 *minutes*. Sorry.
    > What table/columns are indexed by "DNTI_NI1"?
    aaaa.dnti_ni1 is an index ON aaaa.xyz_ticket(xyz_id, ticket_status)
    > And what are the indexes on xyz table?
    Too many:
    XYZ_ARCHIV_STATE_IND           ARCHIVE_STATE
    XYZ_BENE_CUST_ID_IND           BENE_CUST_ID
    XYZ_BENE_TTL_IND               BENE_TTL
    XYZ_CANCEL_STATE_IND           CANCEL_STATE
    XYZ_CLIENT_APP_NI              CLIENT_APP
    XYZ_CRM_CUST_ID_IND            CRM_CUST_ID
    XYZ_DELIVE_MODE_IND            DELIVERY_MODE
    XYZ_DELIV_BLOCK_IND            DELIVERY_BLOCKED
    XYZ_DELIV_STATE_IND            DELIVERY_STATE
    XYZ_XYZ_BLOCKED                XYZ_BLOCKED
    XYZ_FIRST_TRAVELDATE_IND       FIRST_TRAVELDATE
    XYZ_MASTER_XYZ_IND             MASTER_XYZ_ID
    XYZ_ORG_ID_NI                  ORG_ID
    XYZ_PAYMT_STATE_IND            PAYMENT_STATE
    XYZ_PK                         XYZ_ID
    XYZ_TO_PO_IDX                  TO_PO
    XYZ_UK                         XYZ_NUM
    For ex. XYZ_CANCEL_STATE_IND on CANCEL_STATE seems superfluous to me, as the column may only contain Y or N (or be null)...
    > Have you traced both cases to compare statistics? What differences did it reveal?
    Yes but it only shows more of *everything* (more tables blocks accessed, the same
    for indexes blocks, for almost all objects involved) for the slowest query !
    Greping WAIT on the two trc files made for every statement and counting the
    object IDs access show that the quicker query requires much less I/Os; the
    slowest one overall needs much more blocks to be read (except for the indexes
    DNSG_NI1 or DNPE_XYZ for example). Below I replaced obj# with the table/index
    name, the first column is the figure showing how many times the object was
    accessed in the 10053 file (I ctrl-C'ed my second execution ofr course, the
    figures should be much higher !!):
    [login.hostname] ? grep WAIT OM-quick.trc|...|sort|uniq -c
        335 XYZ_SUMMARY
      20816 AAAA_DSMM_XYZ_UK (index on xyz_summary.xyz_id)
        192 XYZ
       4804 XYZ_INFO
        246 XYZ_SEGMENT
          6 XYZ_REMARKS
         63 XYZ_PNR_ERS
        719 XYZ_PK           (index on xyz.xyz_id)
       2182 DNIN_IDX_NI5     (index on xyz.xyz_id)
        877 DNSG_NI1         (index on xyz_segment.xyz_id, segment_status)
        980 DNTI_NI1         (index on xyz_ticket.xyz_id, ticket_status)
        850 DNPE_XYZ         (index on xyz_pnr_ers.xyz_id)
    [login.hostname] ? grep WAIT OM-slow.trc|...|sort|uniq -c
       1733 XYZ_SUMMARY
      38225 AAAA_DSMM_XYZ_UK  (index on xyz_summary.xyz_id)
       4359 XYZ
      12536 XYZ_INFO
         65 XYZ_SEGMENT
         17 XYZ_REMARKS
         20 XYZ_PNR_ERS
       8598 XYZ_PK
       7406 DNIN_IDX_NI5
         29 DNSG_NI1
       2475 DNTI_NI1
         27 DNPE_XYZ
    The overwhelmingly dominant wait event is by far 'db file sequential read':
    [login.hostname] ? grep WAIT OM-*elect.txt|cut -d"'" -f2|sort |uniq -c
         36 SQL*Net message from client
         38 SQL*Net message to client
    107647 db file sequential read
          1 latch free
          1 latch: object queue header operation
          3 latch: session allocation
    > It will be worth knowing the estimations...
    It show the same plan with a higher cost when PAYED = N is added:
    SQL> select * from sb11.dnr d
      2* where d.dnr_blocked IS NULL and d.cancel_state = 'N'
    SQL> /
    | Id  | Operation                   | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                      |  1002 |   166K|    40   (3)| 00:00:01 |
    |*  1 |  TABLE ACCESS BY INDEX ROWID| XYZ                  |  1002 |   166K|    40   (3)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | XYZ_CANCEL_STATE_IND |       |       |     8   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("D"."XYZ_BLOCKED" IS NULL)
       2 - access("D"."CANCEL_STATE"='N')
    SQL> select * from sb11.dnr d
      2  where d.dnr_blocked IS NULL and d.cancel_state = 'N'
      3* and d.payed = 'N'
    SQL> /
    Execution Plan
    Plan hash value: 1292668880
    | Id  | Operation                   | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |                      |  1001 |   166K|    89   (3)| 00:00:01 |
    |*  1 |  TABLE ACCESS BY INDEX ROWID| XYZ                  |  1001 |   166K|    89   (3)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | XYZ_CANCEL_STATE_IND |       |       |    15   (0)| 00:00:01 |

  • I want to copy and past 58 links from my IE favorites into the bookmarks toolbar...not one at a time. where's the folder i can copy these too?

    i want to copy and past 58 links from my IE favorites into the bookmarks toolbar...not one at a time. where's the folder i can copy these too?
    == This happened ==
    Not sure how often
    == i want to copy and past 58 links from my IE favorites into the bookmarks toolbar...not one at a time. where's the folder i can copy these too?

    Firefox doesn't store the bookmarks as separate files in a folder, but uses a sqlite database file with the name places.sqlite.
    You will have to export those favorites in IE to an HTML file and import that file in Firefox.
    Bookmarks > Organize Bookmarks > Import & Backup > Import HTML : "From File"
    See http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • I am unable to get Lightroom Mobile to work on my home network. The Ipad says "There are no collections to sync, enable lightroom mobile on your computer", but it is enabled.  I got it to work one time on another network but not at home where I use Lightr

    I am unable to get Lightroom Mobile to work on my home network. The Ipad says "There are no collections to sync, enable lightroom mobile on your computer", but it is enabled.  I got it to work one time on another network but not at home where I use Lightroom.

    Hi,
    could you please give us some info on what kind of network you have?
    Can other application communicate with the web?
    Thanks,
    Ignacio

  • Where clause with time stamp

    Hii,
    I have an issue with using where clause with time stamp. My requirement is to
    select * from driver_on_policy
    where last_change_datetime = '2001-03-06 19:00:06'
    date is in this form 6/3/2001 7:00:06 PM
    thnks
    sam

    If you want to use '6/3/2001 7:00:06 PM', then
    where last_change_datetime = to_timestamp('6/3/2001 7:00:06 PM','DD/MM/YYYY HH:MI:SS PM')If you can use a literal string in ANSI standard YYYY-MM-DD HH24:MI:SS format, then just
    where last_change_datetime = timestamp '2001-03-06 19:00:06' (That 'DD/MM' might need to be switched around to 'MM/DD' if you are in America.)
    Message was edited by:
    William Robertson

  • TopLink essentials: extra where clause for one to many relationship?

    We have a lot of tables that contain "historic" records. Those are marked by a column "historic" holding a value "Y". Sometimes we are not interested in historic values. For example in the next case:
    @Entity
    @Table(name="ART")
    public class Article {
        @OneToMany(mappedBy="article", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
        private Collection<ArticleStats> arcItems;
        public Collection<ArticleStats> getArticleStats() {
            return arcItems;
    }One article can have multiple "stats". We are in this case only interested in the "stats" of this article that are not historic. In SQL terms, I would like to add an extra where clause: "WHERE historic = 'N'".
    Of course inheritance (with discriminators) is an option, but I don't prefer that. We have a lot of relationships like this and using inheritance would mean we have to add a lot of extra classes. Is there a way to add an extra where clause to the query that is used to retrieve all the stats records related tot my Article?
    We use TopLink essentials with an IBM AS/400 database.

    The JPA Spec does not handle this case, but TopLink Essentials does. You will need to customize your TopLink descriptor using a DescriptorCustomizer. You can set your DescriptorCustomizer in your persistence.xml using the "toplink.descriptor.customizer.<entity-name>" property set to the class name "<package>.<class>" of your customizer class.
    The customizer would look something like:
    public class MyCustomizer implements DescriptorCustomizer {
    public void customize(ClassDescriptor descriptor) {
    OneToManyMapping mapping = (OneToManyMapping )descriptor.getMappingForAttributeName("arcItems");
    ExpressionBuilder builder = new ExpressionBuilder();
    mapping.setSelectionCriteria(builder.getField("STAT.ART_ID").equal(builder.getParameter("ART.ID").and(builder.getField("HISTORY").equal("N")));
    If you never wanted historical records you could also add this expression to your descriptor's additionalJoinExpression.
    James Sutherland

  • Where clause on one column out of two

    I have a where clause filtering out data from the sum(workhour) column. I want to return another column beside it that does not filter workhour and a third column that filters workhour based on a different criteria. Is this possible?
    sql
    select activity_exit_date.year_id, activity_exit_date.month_id, locked_by, round(sum(workhour*60),1) as 'Maker/Checker Time'
    from activity_exit_date
    right join (project_name right join time_tracking on project_name.projectname_id=time_tracking.projectname_id)
    on Activity_Exit_Date.Activity_Exit_Date=time_tracking.Activity_Exit_Date
    where projectname like '%Maker%'
    group by activity_exit_date.year_id, activity_exit_date.month_id, locked_by
    year month locked_by maker/checker
    2     2.0     aa93971     9316.2
    2     2.0     ab41741     330.0
    2     2.0     ab48799     8068.8
    2     2.0     ag27219     7230.0
    2     2.0     ah96254     7216.2
    2     2.0     ah96763     6180.0
    2     2.0     aj58427     1170.0
    2     2.0     ak27324     7596.0
    2     2.0     am37564     2790.0
    2     2.0     ar04163     9885.0
    2     2.0     as03789     9492.0
    2     2.0     av04089     4854.0
    2     2.0     aw03010     10056.6
    thanks!
    J

    Hi,
    Conditions in the WHERE clause affect the entire result set.
    If you want certain conitions only to apply to certain columns, then put the condition in a CASE expression.
    For example:
    SELECT       deptno
    ,       COUNT (*)          AS total_cnt
    ,       COUNT ( CASE
                     WHEN  job = 'CLERK'
                   THEN  1
                  END
                )          AS clerk_count
    ,       COUNT ( CASE
                     WHEN  sal > 1000
                   THEN  1
                  END
                )          AS sal_1000_cnt
    FROM      scott.emp
    GROUP BY  deptno;Output:
        DEPTNO  TOTAL_CNT CLERK_COUNT SAL_1000_CNT
            30          6           1            5
            20          5           2            4
            10          3           1            3Note that these are the same numbers we would get by running these queries separately:
    SELECT  deptno, COUNT (*) FROM scott.emp                  GROUP BY deptno;
    SELECT  deptno, COUNT (*) FROM scott.emp WHERE job = 'CLERK' GROUP BY deptno;
    SELECT  deptno, COUNT (*) FROM scott.emp WHERE sal > 1000    GROUP BY deptno; 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Updating one table with mult. table where clause

    I'm having problems with my update statement. I want to update one table that has a mulitple table where clause. Not sure how to accomplish this. Here is what I have so far.
    update lawson.apvenmast a
    set vendor_status = 'I'
    where ((select * from apinvoice i
    where i.due_date <= TO_DATE('20011231', 'YYYYMMDD') and
    i.vendor = a.vendor)
    ((apvenmast.ven_class = 'INS') or
    (apvenmast.ven_class = 'REF')));
    Am I on the right track?
    thanks in advance for any help.
    Lisa Mears

    A lot is missing.
    where ((select * from apinvoice iA where clause should be like
    where <something> IN (select <something> from ...)
    ((apvenmast.ven_class = 'INS') or
    (apvenmast.ven_class = 'REF')));Where does this belong? There is no AND or OR with these two lines.
    Check your table aliases too.

Maybe you are looking for

  • 120 GB HD or 160 GB HD? (Looking to buy a White MacBook)

    I am hopefully getting a White MacBook (2.0 GHz, C2D processor), and I was wondering whether the 120 GB model would be better for me, or the more expansive 160 GB model would suit me better. I have read the advice that they have for you when you are

  • Error message Insufficient Credit

    Hello, I am trying to call a mobile phone in/from the Philippines from Mexico but when i dial the phone I get a message that says 'insufficient credit' even though I have all 60 minutes left from my World minutes for Office 365 subscription. What exa

  • Installation of translationhub in oracle 10g

    hi i am completely stuck,i want to know how to install translation hub in oracle 10g.i feel lost after searching google and oracle.pls help

  • PP-QM

    Hi Expert Can u tell me how PP-QM integrate... And how this integration are configured and triggerd the pp-qm cycle. Regards Nitu pp

  • Batch resize artboard on 400+ files via Actions or Script needed

    I have over 400 AI files to process and I need to change the artboard size to the following specifications exactly on all files: X: 108 px Y: -108 px W: 216 px H: 216 px Does anyone have a script for this? I did some digging and came up empty. Any he