Control null to a variable binding in the view criteria

Hi, greetings.

I use Jdeveloper 11.1.2.0.

I have a view object, LocationsView, for the locations of the database of the tenth Board.

I want to apply a condition, ((: bind_var is null) or (: bind_var is not null and location_id =: bind_var), in this LocationsView.)

In other words, I want to apply the condition only if the value of the bind variable is not null.

How can I build this condition using a declarative view criteria?

Any help and advice on this topic is greatly appreciated.

Kind regards
Guru K

It should work if you set the box on her "ignore Null values" when you set criteria.

Timo

Tags: Java

Similar Questions

  • How not to display variable binding in the query ADF search panel?

    Hello, I use JDeveloper 11.1.2.3.0.

    I have a variable binding in my VO, (* required) that I use in the sql query. I put the value of this variable to link through the groovy expression so I don't have to manually put through my page. It works fine but the problem is that it appears in the query ADF Panel that I created in my page. To do this, I created a ViewCriteria and I've specified to display only 3 (other) fields for the simple search. Apart from the selected 3 variable bind shows here again because its value is set. I tried to remove the ' * required ' of the variable binding in the original Version, but in this case I have problems with my sql query.

    Does anyone know how this variable is not to display in the Panel request ADF?

    Thank you

    Has tried to define the binding to bee hidden variable?

    Controll tips, hint of display = hide

  • Problem with between operator in the view criteria

    Hello

    We have a requirement. In the view criteria, we have a Timestamp attribute. We use between operator , so we have two variable bind fromDate and up to date . The search works fine if I give to plu date fromDate but if the same date for the bind variable, it does not return all records in the table .

    Any solution to overcome this peoblem?




    KR

    KR,

    So are the timestamps fromDate and up-to-date? Are they fair dates, then they will be interpreted as midnight as-des-than-present, and unless your timestamp is from midnight, it would not be between them more. You can also set - Djbo.debugoutput = console in the properties of your project to see the SQL query running in the log window.

    John

  • outer join in the view criteria

    Hello world

    I use jdeveloper 11.1.1.6.0

    I want to create outer join in the view criteria, so I had to substitute getCriteriaItemClause ViewObjImpl.java method

    my query is like this:

    SELECT t1. row_no, t2.type FROM table_1 t1, t2 from table_2

    WHERE t1. row_no (+) = t2. row_no

    and t1.user_Id (+) =: bindVar

    table_1 (row_no, user_Id)

    table_2 (row_no, type)

    the part " t1.user_Id (+) =: bindVar " should be put in the display criteria

    the method:

    @Override

    public String getCriteriaItemClause (ViewCriteriaItem viewCriteriaItem) {}

    String newQeury = this.getEntityDef (0) .getAliasName () + "." + viewCriteriaItem.getColumnName () + "(+) =:bindVar .

    Return newQeury;

    }

    but when I run the criteria see exception below raises:

    oracle.jbo.expr.JISyntaxError: Houston-36000: an unexpected token expression is found.

    When I remove the sign "(+)" of newQeury

    String newQeury = this.getEntityDef (0) .getAliasName () + "." + viewCriteriaItem.getColumnName () + "=:bindVar .  remove the sign "(+)" before =:bindVar

    raises the exception below

    Houston-29000: Unexpected exception caught: oracle.jbo.expr.JIEvalException, msg = Houston-25077: t1 name not found in the given object: ViewRow [[5-1-5] oracle.jbo.Key].

    Habib

    This is a duplicate of https://forums.oracle.com/thread/2577092

    Please do not post your questions several times.

    A possible solution posted to the original thread.

    Timo

  • Variable binding in the procedure and function

    Hello

    I started reading ORACLE 11 g R2 PL/SQL programming doc and I'm stuck to bind the variable. I just copied the example in the books and found error-

    First of all, I wrote the procedure below and compiled with - success
    CREATE OR REPLACE PROCEDURE FORMAT_STRING ( string_in IN OUT VARCHAR2) AS
    BEGIN
     string_in := '[' || string_in || ']';
    END FORMAT_STRING;
    Then I wrote below function and also compiled successfully-
    create or replace function join_strings  (str1 varchar2, str2 varchar2)
    return varchar2 is
    begin
      return str1||' '||str2||'.';
    end;
    Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.
    variable session_var varchar2(200)
    call join_strings ('I Love','you') into :session_var;
    call format_string(:session_var);
    Maoulida

    Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.

    variable session_var varchar2(200)
    call join_strings ('I Love','you') into :session_var;
    call format_string(:session_var);
    

    If you want to do it in PL/SQL, you can use an anonymous PL/SQL block like that.

    set serveroutput on
    declare
      session_var varchar2(200);
    begin
      session_var := join_strings ('I Love','you');
      format_string(session_var);
      dbms_output.put_line(session_var);
    end;
    /
    

    If you want to run directly in SQL Plus you can do

    var session_var varchar2
    
    exec :session_var := join_strings ('I Love','you')
    
    exec format_string(:session_var)
    
    print session_var
    
  • Change name of variable binding and the performance

    I read the use of bind variables is very good for performance because DB Oracle uses the existing execution plan and not able to analyze the query again.

    If I change the name of the variable, the DB will analyze this new?

    In the example, if my request is:
    select * from customers where customerId =:id;
    and I change to:
    select * from customers where customerId =:customerId;
    the second query will be parsed or not?

    The 10g Performance Tuning Guide describes the 'cursor sharing criteria' and gives a clear example:

    5 bind variables in the SQL statements must correspond to the name, the data type and length.
    For example, the following statements cannot use the same shared SQL area,
    because bind variable names can be distinguished:

    SELECT * FROM employees WHERE department_id =: department_id;
    SELECT * FROM employees WHERE department_id =: dept_id.

    Kind regards
    Bob

  • The View of line object count goes to zero after removing the view criteria.

    Hello

    I use JDeveloper 11.1.1.4.

    I applied viewCriteria to a viewObject. Its working fine.

    But after that when I remove this ViewCriteria using removeApplyViewCriteriaName () /removeViewCriteria (), the number of lines of this same viewObject is 'null '.


    Kind regards

    Alok

    Rather than use getRowCount(), which is not good if you get several rows in the back, use getEstimatedRowCount(), which requires the DB how many rows are returned.

    Then, you can start your apuplication with - Djbo.debugoutput = console so that you see what request is sent to the db. Or you use this class VO Dump request and it & #8217; s parameter with their values. JDev & amp; ADF Goodies to get only the query and parameters of the journal.

    Timo

  • limit the view criteria values prompt values based on others...

    Hi all

    I want to use a component of af: query a selection of custom view. It is possible to restrict the values of a a command prompt with the values of other selected guests... (for example when the user choice department_location, only the departments at this location appears in the guest/combo ministries..)

    Thank you...

    Yes, this should be possible. Discover vidoe Shay https://blogs.oracle.com/shay/entry/dependent_lovs_in_an_afquery_c

    Timo

  • Problem 'On or before' operation in the view criteria

    Hello

    I have a query like the one below and I defined in a required display to display all the transfer_date "OnOrBefore" today's date but is to show data only before the current date not on the current date. Any reason why this is happening?
    SELECT a.TRANSFER_ID
         , a.TRANSFER_DATE
         , a.ASSET_CATEGORY_ID
         , a.ASSET_ID
         , a.TRANSFER_FROM_ID
         , a.TRANSFER_TO_ID
         , a.STOCK_TAG
     FROM TRANSFER a
    INNER JOIN (
                  SELECT STOCK_TAG
                       , MAX(TRANSFER_DATE) maxDATE
                    FROM TRANSFER
                   GROUP BY STOCK_TAG
                ) b
       ON a.STOCK_TAG = b.STOCK_TAG AND
          a.Transfer_Date =b.maxDATE
    Thank you
    Sam

    And what about time data (27-11-2012 ' 00:00:00.000')?

    AP

  • Variable adjustment of binding of view criteria during the loading of the page

    Is there a way to define declarative variable bind according to which the page is loaded?

    I have a view object, a variable binding and a view criteria which makes use of this variable. I have two pages on each one I dropped my criteria to view as a table read-only ADF. I need the variable contains a value on the first page and others on the second. The values are static.

    In other words, I want the lines to filter a sense when I navigate to the first page, when I browse to the second.

    If there is no way to do so declaratively, I would like to know how to do it programmatically. I tried to add methods to the Module of the Application, but it seems that I can't use a custom method as an iterator of data control. I can only think of the use of two PagePhaseListeners to assign the value to this variable (using setNamedWhereClauseParam()), but this solution does not seem very right. Do not have two criteria seen separate.

    Hello

    Basically, you can use routers in your workflow, based on some properties of flow, you can determine what value to place, then call ExecuteWithParams as Chris mentioned previously.

    Kind regards
    Dimitris.

  • SOAP Web service only works if the binding variable included in the object view


    JDeveloper version - 11.1.1.7.0


    I did this video Building WS to an existing of ADF - Insider ADF application for the integration of web services SOAP at my request. It worked fine until I added a variable binding to the my view object (after which she stopped recovery of values). I tried checking the log by modifying the FINEST logging level as proposed for ADF BC Logging none of the mistakes. Please help me on changes to make it work.

    Answered by thread

    ERROR when using ViewCriteria in search of Service BC ADF

  • 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 set the value of the variable bind in VO on page load?

    Hello, I use JDeveloper 11.1.2.3.0.

    I created a VO in my application that uses a variable binding in the where clause. I want to put the value of this variable on the loading of the page automatically.

    I read that I can do this through setNamedWhereClauseParam()... but I can't find out where and how to use it.

    Can anyone help please?

    You can put in different places:

    AppModuleImpl,

    ViewObjectImpl,

    ViewRowImpl

    Just him export the customer interface and use whenever you want

  • Use sessionScope as the value of the Variable binding

    Dear all,

    I have a variable in sessionScope, and I want to use it as a condition of application of a ViewObject.

    I found a thread talking about, there's only one: (Re: set the value in the global variable. )
    How to use the value in the scope of session groovy script?

    Model project:
    Set variable in the scope of the session:
    ADFContext.getCurrent () .getSessionScope () .put ("Empno", empno);

    Getting value of session scope:
    Object empno is ADFContext.getCurrent () .getSessionScope () .get ("Empno");.

    ViewProject:
    Set variable in the scope of the session:
    FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .put ("Empno", empno);

    Getting value of session scope:
    Object empno is FacesContext.getCurrentInstance () .getExternalContext () .getSessionMap () .get ("Empno");.

    Getting value of scope jspx page session
    #{sessionScope.Empno}

    Hi Samson,.

    Here are the groovy expression to access the value of the sessionscope:

    adf.context.sessionScope.role
    

    But, as the said John instead to access the session of the model can be a method of model (whether in AMImpl or voImpl) who takes the role as a parameter value and sets the value of the variable binding of the vo, then call this AM from the bean method passing the role value by getting the scope of the session.

    Jean Lou

  • Variable binding defined in LOV

    Hi, I use JDev 11.1.1.7

    I have a VO (FundingNameVO) which takes in bind variable.

    FundingNameVO is used as LOV in an another VO (ProjectVO) for a FundingName attribute.

    ProjectVO also has an attribute FundingSource has also a LOV.

    When FundingSource is selected, the value must be sent to the liaison FundingNameVO variable to determine the LOV to display for FundingName,

    How to pass the FundingSource value to the variable of FundingNameVO binding?

    Thank you.

    Hello

    If the value of the variable binding from attribute ProjectVO follow these steps:

    in tab display accessor is ProjectVO, you have added an instance of FundingNameVO, click the view accessor on Edition, then in the open Panel, you see the bind variable, set the value of the variable binding with the good ProjectVO attribute name

    If not check this: http://www.jobinesh.com/2011/03/initializing-bind-variables-in-query.html

    Kind regards

    Habib

Maybe you are looking for