Update Bind variable during the click on chart?

New to ADF, so getting started is a little rough right now.

I created a couple of display objects, trained in my JSF page and created the graphics bar out of them. I can click on the series in the bar chart and update a table ADF without problem. What I would do, is to take the result of the click (I know how to find the value of the Group since the click) and past this value in another view to display a new table.

So the question is how can I update a binding for a display object variable and display the results in a table of the ADF?

I have a query: "select user_name, user_role from users where user_id =: userId" with a variable named liaison: userId. It took the form of the ADF on my page and rendering: false and display: false. What I would do, is updated ": userId" variable with a value of the graph and display of the form.

Any help?

Thank you!

Hello

I think that the blog post from this Shay can be useful for you:
http://blogs.Oracle.com/Shay/2009/01/setting_parameter_for_before_p.html

Kind regards

Branislav

Tags: Java

Similar Questions

  • How to use several adf 12 shape and insert the form data in to table during the click on "submit" button

    How to use several adf 12 shape and insert the form data in to table during the click on "submit" button. Can we use several form from adf or not?

    Make sure that you dragged the VO based EO.

    Also make sure that the VO attributes based EO Updatable property.

    The query according to VO is used only to add LOV to the column of the original VO ModelId.

    See you soon

    AJ

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • My 8 window is not updated and updates are appearing during the verification of updates.

    Original title: updates

    my 8 window is not updated and updates are appearing during the verification of updates

    Please run the Windows Update Troubleshooter:
    http://go.Microsoft.com/?linkid=9830262

    Please provide details of any problem it reports as not fixed.

  • on change of value event I'm shooting adf Faces error message but its getting recorded during the click on save

    Hi Experts,

    JDEV 11.1.1.7.0

    On valueChangeEvent I throw adfFacesErrorMessage but its economy during the click on save.

    Because I can't do validation in my OE. So I can use validator instead of valuechange evnt. ? While it will not allow something to save.

    autoSubmit = "true" validator = "#{backingBeanScope.myBean.checkValidation}" >

    On valueChangeEvent I throw adfFacesErrorMessage but its economy during the click on save.

    Message is just to what is expected.

    So can I use instead of evnt valuechange validator.

    Yes, you must use the validator to implement validation

    Dario

  • Update a problem during the installation!

    Update a problem during the installation!

    U44... Update error http://forums.adobe.com/thread/1289956 can help

    10.10.5 Mac has new problems, but I have no connection to this version

    Fix possible Mac 10.10.4 (at least for Premiere Pro) https://forums.adobe.com/thread/1891705

  • bind variables using the values in the collection

    Hi the gems... Good afternoon...

    Can we not use plsql values in the collection in the USING clause to pass the bind variable values...

    I wrote the procedure to kill all sessions that cross the parameter OPEN_CURSORS below. the query, I found only three sessions that exceed. But when I execute my procedure so those are not removed, execution gives me an error also. He simply executed but no session has been killed.

    My part of the code is as below:
    ..........
    ..........
    ..........
    OPEN rc FOR v_sql;
        FETCH rc BULK COLLECT
            INTO v_tt_sessions;
        LOOP
            EXIT WHEN v_tt_sessions.COUNT = 0;
            FOR idx IN 1 .. v_tt_sessions.COUNT
            LOOP
                EXECUTE IMMEDIATE 'alter system kill session '':a,:b'' immediate'
                    USING v_tt_sessions(idx).sid, v_tt_sessions(idx).serial#;
            END LOOP;
        END LOOP;
    CLOSE rc;
    .........
    .........
    However, when I replace the bind variable with the values in the collection, then it works:
    ..........
    ..........
    ..........
    OPEN rc FOR v_sql;
        FETCH rc BULK COLLECT
            INTO v_tt_sessions;
        LOOP
            EXIT WHEN v_tt_sessions.COUNT = 0;
            FOR idx IN 1 .. v_tt_sessions.COUNT
            LOOP
                EXECUTE IMMEDIATE 'alter system kill session '''||v_tt_sessions(idx).sid||','||v_tt_sessions(idx).serial#||''' immediate';
            END LOOP;
        END LOOP;
    CLOSE rc;
    ..........
    ..........
    Please suggest if there is something wrong in my code first. I tried, but could not get any inadequacy.

    But the doubt is when I removed the variable of liaison with the values of the collection hard-coded (in my first post), then this process works very well. But I want to use bind variables.

    You cannot use bind variables in this situation. You can use bind variables for the DML statements.
    I'm surprised that you have no error, but I guess that this block of code explains everything:

    EXCEPTION
        WHEN OTHERS THEN
            dbms_output.put_line(SQLCODE || ' : ' || SQLERRM);
      
    

    You concatenate values to build a single command ALTER SYSTEM and run, just like your second attempt.
    You don't need to have a dynamic cursor either.

    for r in (
      select v.SID, u.serial#, count(v.sid)
      from v$open_cursor v, v$session u
      where v.CURSOR_TYPE='OPEN'
      and v.sid=u.sid group by v.sid, u.serial#
      having count(v.sid)>190
      order by count(*) desc
    )
    loop
      execute immediate 'alter system kill session '''||r.sid||','||r.serial#||''' immediate';
    end loop;
    

    And of course, I agree with the comments of Keith (assuming that this is not just an exercise).

    Published by: odie_63 on October 16, 2012 14:03

  • Updates to Windows during the stoppage has not taken effect and the same updates (16 of them) keep coming back in the next restart.

    Original title: Windows updates has not taken effect.

    My Windows updates during the shutdown did not effect. The same updates (16 of them) keep coming back in the next restart.

    I tried fixed it 50461 mentioned in one post, but the problem persists.

    Any help to appreciate.

    Hi Lee CC,.

    1 windows operating system you are using?

    2. you receive an error code or error messages?

    3. Why have you tried the Fixit 50461? Have you received a 646 error?

    This problem can occur if updates failed to install.

    Method 1:

    You can read the following article and try to reset the Windows Update components and check.

    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Method 2:

    You can also read the following article and check if it helps.

    Troubleshooting Windows Update or Microsoft Update when you are repeatedly offered an update

    http://support.Microsoft.com/kb/910339

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • JDev 11.1.2.1 method Execute (with bind variable) before the page is displayed

    Hi all

    I have a view object with a query that uses a variable binding. I drag the data on my .jsf page control to create a table. I create a query method on a bean in sight. The query method uses the content of one of the attributes of the bean to set the link for the query variable:

    vo.setNamedWhereClauseParam ("CraIdBindVar", sessionBean.getCraId ());

    I put a button on the page that calls the method of the request and it fills the table. That's fine, but I don't want the user to have to click the "query" button when browsing this page. I found forums dealing with create an AMImpl.jave method, create a link on the page, create an executable file for the link. It works that the method is executed until the page appears. However, the AMImpl method cannot call sessionBean.getCraid () to obtain the data required to complete the binding variable.

    Is it possible to run my method of view range bean before the page is displayed? Or maybe a way for the AMImpl.java method to access the range of view variable?

    Thank you, Steve

    Steve,
    You can drag a call method on the workflow activity. Select the new method call activity, and open the property inspector. Here you choose your bean method in the method property. Now, first of all, you go to this activity of method call, then the page.

    Timo

  • Bind Variables on the view objects child definition

    JDeveloper 12 c

    I have an interesting question.  I have a view (AisWebModulePrivsVO) object that uses a bindvariable hardcoded in the view object.

    SELECT * FROM SYS. DBA_ROLE_PRIVS where DEALER =: bvUserName

    If I put this in the request module I can programmatically set the variable binding (view object contains the getter/setter for the binding variable).

    AisWebModulePrivsVOImpl voTest = am.getAisWebModulePrivsVI ();

    voTest.setbvUserName ("ARAWLS");

    voTest.executeQuery ();

    System.out.println ("test reports:" + voTest.getRowCount ());

    and get the correct number of records based on return on the user and database roles. If it works.

    What does NOT work, it is when this display object is a recording of 'the child' to another display object (as specified by a link between the two and by setting the object from a point of view as one child of the other in the module of the application).

    AppModule looks like this:

    CgRefCodesVO

    AisWebModulePrivsVO

    In this case, I have a view called cgRefCodeVO parent object.  There is a link between this and the AisWebModulePrivsVO. The relationship works.

    AISMenuAppModuleImpl m = ADFUtils.getApplicationModuleForDataControl (appMod) (AISMenuAppModuleImpl);

    CgRefCodesVOImpl cgRefVO = am.getCgRefCodes1 ();

    AisWebModulePrivsVOImpl modsVO = am.getAisWebModulePrivs1 ();

    modsVO.setbvDBUserName ("ARAWLS");  This doesn't seem to work here...

    cgRefVO.executeQuery ();

    All lines rs = cgRefVO.getRowSet ();

    RS. Reset();

    While (rs.hasNext ()) {}

    CgRefCodesVORowImpl CgRefRow = rs.next ((CgRefCodesVORowImpl));

    System.out.println ("RvLowValue:" + CgRefRow.getAttribute ("RvLowValue"));

    RowIterator aisModulesRowIter = CgRefRow.getAisWebModulePrivs ();

    System.out.println ("number of children:" + aisModulesRowIter.getRowCount ());

    }

    The code compiles and runs.  She translates: "County of the child: 0" for each row returned by the

    I also tried:

    VM VariableValueManager = modsVO.ensureVariableManager ();

    vm.setVariableValue ("bvDBUserName", "ARAWLS");

    And:

    modsVO.setNamedWhereClauseParam ("bvDBUserName", "ARAWLS");

    and (of https://community.oracle.com/message/2746551#2746551 ( )

    @Override

    protected void executeQueryForCollection (Object, object, Object [] object2, int i) {}

    I coded everything hard to see if it would work.

    setNamedWhereClauseParam ("bvDBUserName", "ARAWLS");

    super.executeQueryForCollection (object, object2, i);

    }

    and from there, I changed around the order to execute the objects in view.    https://community.oracle.com/message/10632314#10632314

    How can I set the variable binding in the object view child?

    Thank you

    Stuart

    It is an interesting example how ADF works up to a certain point... then you need to start to make cuts to modify its behavior as you wish.

    I decided that it was just easier to delete 'the child' parent (in the app module) and create a view of criteria on this subject for what would basically query the records to get the same results, like a child.

    Perhaps not as elegant, but so much easier.

    Thanks for your help.

    Stuart

  • How to show or hide the region of the shuttle during the click on the radio buttons?

    Hello

    I'm new to JDeveloper. Here is my requirement.

    1. create 2 radio buttons: Yes and no and default displays "" selected radio button.

    2. create a region of shuttle with select query in VO.

    Query is:

    Select 'No group' for_user, for_pkg double null

    Union

    Select "Company" for_user, for_pkg "SEGMENT1" double

    Union

    Select 'Rental' for_user, for_pkg 'SEGMENT2"double

    Union

    Select 'Cost center' for_user, 'SEGMENT4' double for_pkg

    Union

    Select 'Project' for_user, 'SEGMENT5' double for_pkg

    Union

    Select "Intercompany" for_user, "SEGMENT8" for_pkg of the double

    order by nulls first for_pkg

    3. initially hide the region of the shuttle during the loading of the page.

    4. click on the radio button 'yes', display area of the shuttle with values at the head of list of query VO and empty list leak.

    5. new click on the 'no' radio button, he must hide region and so screen shuttle shuttle dynamically according to the selected option button.

    But my problem is I am able to hide area shuttle when the page loads at the beginning and after that, when I'm clicking 'Yes' radio button, is just to display area shuttle empty without value in the main list and once when I'm clicking 'No' radio button, it should hide area shuttle but he's not hiding. I used the RPP to show or hide the area Shuttle under certain conditions. I use JDev 10.1.3.3.0 version as we Oracle EBS version 12.1.2 in our society.

    Please find the attached draft and suggest me proper with examples of sample approach.

    Monika,

    I tried to get this working in the lower version of Jdeveloper and looks like it works.

    Can you make the change below and see what happens.

    1. modify your query to VO as below: (I replaced null with SEGMENT0)

    select 'No Grouping' for_user, 'SEGMENT0' for_pkg from dual
    union
    select 'Company' for_user, 'SEGMENT1' for_pkg from dual
    union
    select 'Location' for_user, 'SEGMENT2' for_pkg from dual
    union
    select 'Cost Center' for_user, 'SEGMENT4' for_pkg from dual
    union
    select 'Project' for_user, 'SEGMENT5' for_pkg from dual
    union
    select 'Intercompany' for_user,'SEGMENT8' for_pkg from dual
    order by for_pkg
    

    2. place VO execution to the processFormRequest:

        public void processFormRequest(OAPageContext pageContext,
                                       OAWebBean webBean) {
            System.out.println("In process Form Request");
            super.processFormRequest(pageContext, webBean);
            OAApplicationModuleImpl appModule =
                (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
            String eventParam = pageContext.getParameter(EVENT_PARAM);
            System.out.println("eventParam: " + eventParam);
            if ("showHideShuttle".equals(eventParam)) {
                //  appModule.invokeMethod("deletetrailing");
                System.out.println("Inside If");
                OAMessageCheckBoxBean messageCheckBoxBean = (OAMessageCheckBoxBean)webBean.findChildRecursive("checkBoxBean");
                System.out.println("messageCheckBoxBean : " + messageCheckBoxBean);
                String messageCheckBoxBeanVal = (String)messageCheckBoxBean.getValue(pageContext);
                System.out.println("messageCheckBoxBeanVal: " + messageCheckBoxBeanVal);
    
                if ("Y".equals(messageCheckBoxBeanVal)) {
                    OAViewObjectImpl shuttleVO1 =
                        (OAViewObjectImpl)appModule.findViewObject("ShuttleVO1");
                    if (shuttleVO1 != null) {
                        shuttleVO1.setWhereClause(null);
                        shuttleVO1.setWhereClauseParams(null);
                        shuttleVO1.executeQuery();
                        System.out.println("Executed Query : " + shuttleVO1.getQuery());
                    }
                    OAViewObjectImpl shuttleVO2 =
                        (OAViewObjectImpl)appModule.findViewObject("ShuttleVO2");
                    if (shuttleVO2 != null) {
                        shuttleVO2.setWhereClause("1=2");
                        shuttleVO2.setWhereClauseParams(null);
                        shuttleVO2.executeQuery();
                        System.out.println("Executed Query1 : " + shuttleVO2.getQuery());
                    }
                }
                String[] name = { "RenderAttr1" };
                String[] val = { messageCheckBoxBeanVal };
    
                Serializable[] params = { name, val };
                Class[] paramTypes = { String[].class, String[].class };
                appModule.invokeMethod("setXXCustomPVOValues", params, paramTypes);
    
            }
    
        }
    

    3. move Spel link shuttle Bean for the region of header above.

    Some useful links for the shuttle Bean:

    Technology blog based in Java of Sushant: 13. Area of application OFA shuttle

    Framework OA Blog: control of the shuttle as part of OSTEOARTHRITIS

    See you soon

    AJ

  • Oracle.ManagedDataAccess gives ORA-01006 if there is bind variables in the comments, but only on the lines.

    When I go from ODP.NET to the ODP.NET managed some of my questions begins to throw errors missing bind variable.

    I reproduced with a simple example that uses a variable called liaison: unitName

    It's the example SQL:

    SELECT

    : unitName

    Of

    DOUBLE

    Now, if I add a comment at the beginning of the SQL like this:

    -Text with: unitName

    SELECT

    : unitName

    Of

    DOUBLE

    It works, but if I have a variable binding in a comment that is located on a number of the 'same' line, I get ORA-01006:

    This causes the error:

    -First line comment

    -Text with: unitName

    SELECT

    : unitName

    Of

    DOUBLE

    Kind regards

    -Tommy

    I was able to reproduce this problem. I filed Bug 19433348 on your behalf.

    The circumstances in which the bug occurs are fairly easy to get around.

    (1) remove the colon in the second commented line.

    (2) add a space between the '\n' and ' - '.

    If you are one of those things, you won't encounter the bug behavior.

  • Procedure of the ODI - Bind Variables in the conditional statements

    In an ODI procedure, is it possible to add a conditional statement around bind variable?  For example, if I use OdiOutFile as the command on the target and Oracle as the command on the Source, I can use bind variables to fill the data in this table (we are in fact using OdiInvokeWebService and passing a XML structure very complex, but it's easier for testing):

    OdiOutFile-FILE = C: / TEST. TXT

    < person >

    < first > #FIRSTNAME < / first >

    < Middle > #MIDDLENAME < / Middle >

    < last > #LASTNAME < / last >

    < / person >

    It is a way to add a conditional statement using one of these bind variables?  For example, if I wanted to test #MIDDLENAME null and null value, produced this portion of XML, such as:

    OdiOutFile-FILE = C: / TEST. TXT

    < person >

    < first > #FIRSTNAME < / first >

    < % if (#MIDDLENAME! = null) {% >}

    < Middle > #MIDDLENAME < / Middle >

    < %} % >

    < last > #LASTNAME < / last >

    < / person >

    This type of scriptlet syntax seems to work fine, as long as the binding variable is not in the mix (if I put "true is true" or "true == false" in the case, it shows or does not show this line in the XML file, as expected).  I use ODI 11.1.1.7.0

    ----------------------

    Post edited by: KevinPratt

    Thanks for the reply!  As suggested, in what follows, I changed the command and it works as you want

    OdiOutFile-FILE = C: / TEST. TXT-APPEND

    < person >

    < first > #FIRSTNAME < / first >

    < @ if (!) (("#MIDDLENAME".equals(""))) {@ >}

    < Middle > #MIDDLENAME < / Middle >

    {< @} @ >

    < last > #LASTNAME < / last >

    < / person >

    Using the syntax <@ ...="" @="">serve your purpose. Also, I think you might want to include the variable binding in the quotation to avoid syntax errors.

  • The use of bind variables in the application process

    Bind variables refer to elements of session state supported in queries in an application request process?

    All the examples I see show how to pass client side values using the $v () function and the htmldb_get object addParam method and refer to them using the wwv_flow.g_xNN variables, but already available in session state values, I should be able to use them directly in the process, right?

    Thank you

    Yes, they are supported.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Bind variables in the SQL causes slow

    We have a strange problem in our PeopleSoft system that I traced to a SELECT statement using bind variables, if hardcode us them values in SQL, it runs very fast.
    but using bindings (what the application does) a problem of efficiency. I'm going to re - write the code that is based on a view of three tables joined to go against
    the base tables and I don't think I'll have a problem. However, I would like to know why the problem exists in the first place. Here is what info I have:
    Oracle version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    It's the 'good' application without links:
    SELECT COUNT(*)
    FROM sysadm.PS_ERN_PROG_DESCR A
    WHERE A.ERN_PROGRAM = 'VT'
    AND A.ERNCD         = '01'
    AND EFFDT           =
      (SELECT MAX(B.EFFDT)
      FROM sysadm.PS_ERN_PROG_DESCR B
      WHERE B.ERN_PROGRAM = 'VT'
      AND B.EFFDT        <= TO_DATE('2009-10-10','YYYY-MM-DD')
      );
    And the 'good' explains the plan:
     Plan hash value: 3344976101
    
    -------------------------------------------------------------------------------------------------------------
    | Id  | Operation                              | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                       |                    |     1 |    33 |    58  (23)| 00:00:01 |
    |   1 |  SORT AGGREGATE                        |                    |     1 |    33 |            |          |
    |   2 |   NESTED LOOPS                         |                    |     1 |    33 |     3   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                        |                    |     1 |    22 |     2   (0)| 00:00:01 |
    |*  4 |     INDEX UNIQUE SCAN                  | PS_ERN_PROGRAM_DEF |     1 |    12 |     1   (0)| 00:00:01 |
    |   5 |      SORT AGGREGATE                    |                    |     1 |     9 |            |          |
    |   6 |       VIEW                             |                    |    23 |   207 |    51  (26)| 00:00:01 |
    |*  7 |        FILTER                          |                    |       |       |            |          |
    |   8 |         SORT GROUP BY                  |                    |    23 |  1748 |    51  (26)| 00:00:01 |
    |*  9 |          HASH JOIN                     |                    |  2995 |   222K|    49  (23)| 00:00:01 |
    |* 10 |           TABLE ACCESS FULL            | PS_EARNINGS_TBL    |  1913 | 24869 |    15   (7)| 00:00:01 |
    |* 11 |           HASH JOIN                    |                    | 13621 |   838K|    30  (20)| 00:00:01 |
    |  12 |            TABLE ACCESS FULL           | PS_EARNINGS_TBL    |  1913 | 42086 |    14   (0)| 00:00:01 |
    |* 13 |            HASH JOIN                   |                    |  3097 |   124K|    14  (29)| 00:00:01 |
    |* 14 |             TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL |     9 |   207 |     2   (0)| 00:00:01 |
    |* 15 |              INDEX RANGE SCAN          | PS_ERN_PROGRAM_TBL |    18 |       |     1   (0)| 00:00:01 |
    |* 16 |             TABLE ACCESS FULL          | PS_ERN_PROGRAM_DEF | 12035 |   211K|    10  (20)| 00:00:01 |
    |* 17 |     INDEX RANGE SCAN                   | PS_EARNINGS_TBL    |     1 |    10 |     1   (0)| 00:00:01 |
    |  18 |      SORT AGGREGATE                    |                    |     1 |    10 |            |          |
    |* 19 |       INDEX RANGE SCAN                 | PS_EARNINGS_TBL    |     1 |    10 |     2   (0)| 00:00:01 |
    |* 20 |    TABLE ACCESS BY INDEX ROWID         | PS_ERN_PROGRAM_TBL |     1 |    11 |     1   (0)| 00:00:01 |
    |* 21 |     INDEX UNIQUE SCAN                  | PS_ERN_PROGRAM_TBL |     1 |       |     0   (0)| 00:00:01 |
    -------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("$vm_col_2") FROM  (SELECT /*+ */
                  "EFFDT" "$vm_col_1","A"."EFFDT" "$vm_col_2" FROM SYSADM."PS_EARNINGS_TBL"
                  "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A",SYSADM."PS_EARNINGS_TBL" "D"
                  WHERE "D"."EFFDT"<="A"."EFFDT" AND "D"."ERNCD"="C"."ERNCD" AND "D"."EFFDT"<=TO_DATE(' 2009-10-10
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "A"."EFFDT"="B"."EFFDT" AND
                  "A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10
                  00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND "C"."ERNCD"="A"."ERNCD" GROUP
                  BY "D"."ERNCD",ROWID,ROWID,ROWID,ROWID,"A"."EFFDT","EFFDT" HAVING "EFFDT"=MAX("D"."EFFDT"))
                  "$vm_view") AND "A"."ERNCD"='01')
       7 - filter("EFFDT"=MAX("D"."EFFDT"))
       9 - access("D"."ERNCD"="C"."ERNCD")
           filter("D"."EFFDT"<="A"."EFFDT")
      10 - filter("D"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))
      11 - access("C"."ERNCD"="A"."ERNCD")
      13 - access("A"."ERN_PROGRAM"="B"."ERN_PROGRAM" AND "A"."EFFDT"="B"."EFFDT")
      14 - filter("B"."EFF_STATUS"='A')
      15 - access("B"."ERN_PROGRAM"='VT' AND "B"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))
      16 - filter("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(' 2009-10-10 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))
      17 - access("C"."ERNCD"='01')
           filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
                  MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE
                  SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND
                  "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3))
      19 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND
                  SYS_OP_DESCEND("EFFDT") IS NOT NULL)
           filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1)
      20 - filter("B"."EFF_STATUS"='A')
      21 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
    Here is the 'good' autotrace:
    SQL> variable ppe_date varchar2(10)
    SQL> variable erncd varchar2(3)
    SQL> exec :ppe_date := '2009-10-10'
    SQL> exec :erncd := '01'
    SQL> SELECT COUNT(*)
      2  FROM PS_ERN_PROG_DESCR A
      3  WHERE A.ERN_PROGRAM = 'VT'
      4  AND A.ERNCD         = '01'
      5  AND EFFDT           =
      6    (SELECT MAX(B.EFFDT)
      7    FROM PS_ERN_PROG_DESCR B
      8    WHERE B.ERN_PROGRAM = 'VT'
      9    AND B.EFFDT        <= TO_DATE('2009-10-10','YYYY-MM-DD')
     10    );
    
      COUNT(*)
    ----------
             1
    
    Elapsed: 00:00:01.23
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=59 Card=1 Bytes=33)
       1    0   SORT (AGGREGATE)
       2    1     NESTED LOOPS (Cost=3 Card=1 Bytes=33)
       3    2       NESTED LOOPS (Cost=2 Card=1 Bytes=22)
       4    3         INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12)
       5    4           SORT (AGGREGATE)
       6    5             VIEW (Cost=52 Card=24 Bytes=216)
       7    6               FILTER
       8    7                 SORT (GROUP BY) (Cost=52 Card=24 Bytes=1824)
       9    8                   HASH JOIN (Cost=50 Card=3177 Bytes=241452)
      10    9                     TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=15 Card=1921 Bytes=24973)
      11    9                     HASH JOIN (Cost=31 Card=14488 Bytes=912744)
      12   11                       TABLE ACCESS (FULL) OF 'PS_EARNINGS_TBL' (TABLE) (Cost=14 Card=1921 Bytes=42262)
      13   11                       HASH JOIN (Cost=15 Card=3303 Bytes=135423)
      14   13                         TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=2 Card=9 Bytes=207)
      15   13                         TABLE ACCESS (FULL) OF 'PS_ERN_PROGRAM_DEF' (TABLE) (Cost=12 Card=12856 Bytes=231408)
      16    3         INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10)
      17   16           SORT (AGGREGATE)
      18   17             INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10)
      19    2       TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11)
      20   19         INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1)
    
    
    
    
    
    Statistics
    ----------------------------------------------------------
              0  recursive calls
              0  db block gets
            182  consistent gets
              0  physical reads
              0  redo size
            232  bytes sent via SQL*Net to client
            278  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
              1  rows processed
    
    SQL> spool off
    ===================================
    This is the 'bad' query using bindings:
    ===================================
    SELECT COUNT(*)
    FROM sysadm.PS_ERN_PROG_DESCR A
    WHERE A.ERN_PROGRAM = 'VT'
    AND A.ERNCD         = :erncd
    AND EFFDT           =
      (SELECT MAX(B.EFFDT)
      FROM sysadm.PS_ERN_PROG_DESCR B
      WHERE B.ERN_PROGRAM = 'VT'
      AND B.EFFDT        <= TO_DATE(:ppe_date,'YYYY-MM-DD')
      );
    The 'bad' explain plan
    explain plan succeeded.
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 337039962
    
    --------------------------------------------------------------------------------------------------------
    | Id  | Operation                         | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                  |                    |     1 |    33 |    20  (25)| 00:00:01 |
    |   1 |  SORT AGGREGATE                   |                    |     1 |    33 |            |          |
    |   2 |   NESTED LOOPS                    |                    |     1 |    33 |     3   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                   |                    |     1 |    22 |     2   (0)| 00:00:01 |
    |*  4 |     INDEX UNIQUE SCAN             | PS_ERN_PROGRAM_DEF |     1 |    12 |     1   (0)| 00:00:01 |
    |   5 |      SORT AGGREGATE               |                    |     1 |    63 |            |          |
    |   6 |       NESTED LOOPS                |                    |     1 |    63 |    13  (39)| 00:00:01 |
    |   7 |        NESTED LOOPS               |                    |     1 |    52 |    12  (42)| 00:00:01 |
    |*  8 |         HASH JOIN                 |                    |     4 |   168 |    12  (42)| 00:00:01 |
    |   9 |          VIEW                     | VW_SQ_1            |    88 |  2112 |     9  (45)| 00:00:01 |
    |  10 |           SORT GROUP BY           |                    |    88 |  2728 |     9  (45)| 00:00:01 |
    |  11 |            MERGE JOIN             |                    |  3087 | 95697 |     7  (29)| 00:00:01 |
    |  12 |             SORT JOIN             |                    |   643 | 11574 |     2   (0)| 00:00:01 |
    |* 13 |              INDEX RANGE SCAN     | PS_ERN_PROGRAM_DEF |   643 | 11574 |     2   (0)| 00:00:01 |
    |* 14 |             SORT JOIN             |                    |    96 |  1248 |     5  (40)| 00:00:01 |
    |* 15 |              INDEX FAST FULL SCAN | PS_EARNINGS_TBL    |    96 |  1248 |     4  (25)| 00:00:01 |
    |* 16 |          INDEX RANGE SCAN         | PS_ERN_PROGRAM_DEF |   643 | 11574 |     2   (0)| 00:00:01 |
    |* 17 |         INDEX UNIQUE SCAN         | PS_EARNINGS_TBL    |     1 |    10 |     0   (0)| 00:00:01 |
    |* 18 |        TABLE ACCESS BY INDEX ROWID| PS_ERN_PROGRAM_TBL |     1 |    11 |     1   (0)| 00:00:01 |
    |* 19 |         INDEX UNIQUE SCAN         | PS_ERN_PROGRAM_TBL |     1 |       |     0   (0)| 00:00:01 |
    |* 20 |     INDEX RANGE SCAN              | PS_EARNINGS_TBL    |     1 |    10 |     1   (0)| 00:00:01 |
    |  21 |      SORT AGGREGATE               |                    |     1 |    10 |            |          |
    |* 22 |       INDEX RANGE SCAN            | PS_EARNINGS_TBL    |     1 |    10 |     2   (0)| 00:00:01 |
    |* 23 |    TABLE ACCESS BY INDEX ROWID    | PS_ERN_PROGRAM_TBL |     1 |    11 |     1   (0)| 00:00:01 |
    |* 24 |     INDEX UNIQUE SCAN             | PS_ERN_PROGRAM_TBL |     1 |       |     0   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       4 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"= (SELECT MAX("A"."EFFDT") FROM
                  SYSADM."PS_EARNINGS_TBL" "C",SYSADM."PS_ERN_PROGRAM_TBL" "B",SYSADM."PS_ERN_PROGRAM_DEF" "A",
                  (SELECT MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) "VW_COL_1","D"."ERNCD" "ERNCD",ROWID
                  "ROWID" FROM SYSADM."PS_EARNINGS_TBL" "D","PS_ERN_PROGRAM_DEF" "A" WHERE
                  "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND
                  SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT") AND
                  SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') GROUP BY
                  "D"."ERNCD",ROWID) "VW_SQ_1" WHERE "ROWID"=ROWID AND
                  "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND "A"."ERN_PROGRAM"='VT' AND
                  "A"."EFFDT"="B"."EFFDT" AND "B"."ERN_PROGRAM"='VT' AND "B"."EFF_STATUS"='A' AND
                  "B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD') AND
                  SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1") AND "ERNCD"="C"."ERNCD" AND
                  "C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1") AND
                  "A"."ERNCD"=:ERNCD)
       8 - access("ROWID"=ROWID)
      13 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD'))
      14 - access(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT"))
           filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=INTERNAL_FUNCTION("A"."EFFDT"))
      15 - filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=TO_DATE(:PPE_DATE,'YYYY-MM-DD'))
      16 - access("A"."ERN_PROGRAM"='VT' AND "A"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD'))
      17 - access("ERNCD"="C"."ERNCD" AND SYS_OP_DESCEND("EFFDT")=SYS_OP_DESCEND("VW_COL_1"))
           filter("C"."ERNCD"="A"."ERNCD" AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))="VW_COL_1")
      18 - filter("B"."EFF_STATUS"='A')
      19 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
           filter("B"."EFFDT"<=TO_DATE(:PPE_DATE,'YYYY-MM-DD'))
      20 - access("C"."ERNCD"=:ERNCD)
           filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))= (SELECT
                  MAX(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))) FROM SYSADM."PS_EARNINGS_TBL" "D" WHERE
                  SYS_OP_DESCEND("EFFDT") IS NOT NULL AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B1) AND
                  "D"."ERNCD"=:B2 AND SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B3))
      22 - access("D"."ERNCD"=:B1 AND SYS_OP_DESCEND("EFFDT")>=SYS_OP_DESCEND(:B2) AND
                  SYS_OP_DESCEND("EFFDT") IS NOT NULL)
           filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("EFFDT"))<=:B1)
      23 - filter("B"."EFF_STATUS"='A')
      24 - access("B"."ERN_PROGRAM"='VT' AND "A"."EFFDT"="B"."EFFDT")
    Here's the bad autotrace:
    SQL> variable ppe_date varchar2(10)
    SQL> variable erncd varchar2(3)
    SQL> exec :ppe_date := '2009-10-10'
    SQL> exec :erncd := '01'
    SQL> SELECT COUNT(*)
      2  FROM PS_ERN_PROG_DESCR A
      3  WHERE A.ERN_PROGRAM = 'VT'
      4  AND A.ERNCD         = :erncd
      5  AND EFFDT           =
      6    (SELECT MAX(B.EFFDT)
      7    FROM PS_ERN_PROG_DESCR B
      8    WHERE B.ERN_PROGRAM = 'VT'
      9    AND B.EFFDT        <= TO_DATE(:ppe_date,'YYYY-MM-DD')
     10    );
    
      COUNT(*)
    ----------
             1
    
    Elapsed: 00:04:07.40
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=20 Card=1 Bytes=33)
       1    0   SORT (AGGREGATE)
       2    1     NESTED LOOPS (Cost=3 Card=1 Bytes=33)
       3    2       NESTED LOOPS (Cost=2 Card=1 Bytes=22)
       4    3         INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=12)
       5    4           SORT (AGGREGATE)
       6    5             NESTED LOOPS (Cost=13 Card=1 Bytes=63)
       7    6               NESTED LOOPS (Cost=12 Card=1 Bytes=52)
       8    7                 HASH JOIN (Cost=12 Card=4 Bytes=168)
       9    8                   VIEW OF 'VW_SQ_1' (VIEW) (Cost=9 Card=88 Bytes=2112)
      10    9                     SORT (GROUP BY) (Cost=9 Card=88 Bytes=2728)
      11   10                       MERGE JOIN (Cost=7 Card=3087 Bytes=95697)
      12   11                         SORT (JOIN) (Cost=2 Card=643 Bytes=11574)
      13   12                           INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574)
      14   11                         SORT (JOIN) (Cost=5 Card=96 Bytes=1248)
      15   14                           INDEX (FAST FULL SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=4 Card=96 Bytes=1248)
      16    8                   INDEX (RANGE SCAN) OF 'PS_ERN_PROGRAM_DEF' (INDEX (UNIQUE)) (Cost=2 Card=643 Bytes=11574)
      17    7                 INDEX (UNIQUE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1 Bytes=10)
      18    6               TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11)
      19   18                 INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1)
      20    3         INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=10)
      21   20           SORT (AGGREGATE)
      22   21             INDEX (RANGE SCAN) OF 'PS_EARNINGS_TBL' (INDEX (UNIQUE)) (Cost=2 Card=1 Bytes=10)
      23    2       TABLE ACCESS (BY INDEX ROWID) OF 'PS_ERN_PROGRAM_TBL' (TABLE) (Cost=1 Card=1 Bytes=11)
      24   23         INDEX (UNIQUE SCAN) OF 'PS_ERN_PROGRAM_TBL' (INDEX (UNIQUE)) (Cost=0 Card=1)
    
    Statistics
    ----------------------------------------------------------
           3820  recursive calls
             66  db block gets
        4677728  consistent gets
          80608  physical reads
              0  redo size
            232  bytes sent via SQL*Net to client
            278  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              2  sorts (memory)
              1  sorts (disk)
              1  rows processed
    
    SQL> spool off

    I think you have to hit some sort of bug in the optimizer. Do you have the histograms on the EFFDT column.

Maybe you are looking for

  • Startup of Firefox now has auto-fill on the search. How can I stop this?

    Start of Firefox, Google search, used to have no AutoFill for searches when I type one search, I want to see suggestions for my research. It is extremely annoying. It's the only reason why I use Firefox Start. Google will not allow you to choose to f

  • remove the HP advisor dock

    Whenever I turn on my HP G56 laptop, the HP Advisor Dock appears. I have not been able to find out how to uninstall it and as I have no use for it, do not want them appearing on the desktop every time on start up. How can I get rid of it permanently,

  • ESX4i does not see the RAID controller card

    I install the ESX4 and the ESXi4. Considering that ESX sess card RAID controller, ESXi4 will not work. I was wondering if there was a solution to this? Memory I don't remember ESXi4 support adding additional drivers (unlike ESX4 Installer) but I was

  • With a variable number of input ports on a Subvi

    How can I have a Subvi with a variable number of input ports that can be changed in the other VI that uses the Subvi?

  • Yoga 2 Pro stutters when you play videos

    Hey guys,. I was wondering if anyone else has this probem stuttering when I look at videons on the yoga 2 pro? I configuring i5/256/8 GB of ram, but really, watch videos should not be a problem for the configuration even lower? Any help would be appr