Mutilple Filter Objects - Changing where clause and or

Is it possible to have a query as below using filter commands.
(obj1 = 'value11' and obj2 = 'value21')
or
(obj1 = 'value12' and obj2 = 'value22')
or
The objective is to manipulate the where clause and , or .
Thanks in Advance
Bhanu Mohanty

Hi Bhanu,
to reach what you want it's necessary to build a virtual characteristic.
The new characteristic will be populated via coding during runtime of your query. Another possibility (as mentioned before in this forum by Siegfried Szameitat) is to create a new characteristic in your cube that contains field1 and field2 concatenated. With the first scenario, you don’t need a reloading of your cube, with second one this is necessary.
Hope this helps.
Bye,
Roberto

Similar Messages

  • How to change where clause in VO query in bean

    Hi experts
    I have to modify vo object query where clause on run time .. is it possible??
    if yes please suggest me,

    as mentioned by Timo, it is very much possible
    see this following link -
    Changing the WHERE clause or VO Query at runtime in Oracle ADF | Techartifact
    Dynamically changing query in view object in Oracle ADF | Techartifact

  • Where clause and order by to DAO classes

    Hi
    Is it ok(I mean design wise) to pass the 'where clause' conditions and order by clause as a parameter to the method of DAO class?

    Well, I would suggest you write seperate methods in your dao , one to select data without the where clause and one to select data with the where clause thrown in. If you have different 'where' clauses for selecting different kinds of data, have that many dao methods. The dao methods being specific know exactly what is the data that's coming in.
    Lets assume you have a list of purchase orders and each purchase order is indetified by a unique id called PURCHASE_ORDER_ID.
    1. The following code would populate a purchase order's details given an id.
    private statis final String QUERY_1 = "select * from PURCHASE_ORDERS where PURCHASE_ORDER_ID = ? ";
    PurchaseOrderModel getPurchaseOrderData(long poId){
         //get a prepared statement from your connection
         PreparedStatement pst = conn.prepareStatement(QUERY_1);
         //set the poId passed as params to your query
         pst.setLong(1, poId);
         ResultSet rs = pst.executeQuery();
         if(rs.next()){
              //populate data into a model          
         finally{
              //clean up resources
         return model;    
    }2. The following code would return a list of PurchaseOrderModel's whose shipping date falls between a set of dates selected by the user.
    private statis final String QUERY_2 = "select * from PURCHASE_ORDERS where SHIPPING_DATE between ? and ? ";
    PurchaseOrderModel getPurchaseOrdersBetweenDates(list bindValues){
         //get a prepared statement from your connection
         PreparedStatement pst = conn.prepareStatement(QUERY_1);
         //set the dates passed as params to your query
         //we know that the List ought to contain only 2 dates
         pst.setDate(1, (Date)bindValues.get(0));
         pst.setDate(2, (Date)bindValues.get(1));
         ResultSet rs = pst.executeQuery();
         if(rs.next()){
              //iterate and populate data into a model          
              //add model to a list
         finally{
              //clean up resources
         return list;    
         3. This is more interesting - the dao method searches a list of Purchase Orders starting with a set of specific words. The words themselves may be one or many. This means that the number of '?' in your prepared statement may be dynamic. Each element of the list is a String that contains the start substring of a purcahse order name. For example - the list may contain elements like ["a", "ab", "c", "gh"] and the dao method returns all purchase order starting with these names.
    private statis final String QUERY_3 = "select * from PURCHASE_ORDERS where ";
    PurchaseOrderModel getPurchaseOrderNameMatches(list bindValues){
         //construct the query dynamically
         StringBuffer query = new StringBuffer(QUERY_3);
         int count = 0;
         for(Iterator itr = bindValues.iterator(); itr.hasNext();;){
              String value = (String)itr.next();
              query.append ("name like 'value%' ");
              if (count != 0 and (count+1 != bindValues.length)){
                   query.append(" or ");
              count ++;          
         //get a prepared statement from your connection
         PreparedStatement pst = conn.prepareStatement(query.toString());     
         ResultSet rs = pst.executeQuery();
         if(rs.next()){
              //iterate and populate data into a model          
              //add model to a list
         finally{
              //clean up resources
         return list;    
    To sum up,
    1. You need as many methods as you have different kinds of searches (one method for each kind of 'where' clause).
    2. The ejb/business layer would examine the data and decide on which method to call.
    3. Increases coding effort, but makes the code clean and readable. Each layer does it's job. Thus we dont have ejbs forming 'where' clauses and so on.
    Having said that, it really is your decision - you should take into consideration the following factors -
    1. How big is the project ? If its a huge codebase developed by many people, then segregate the responsibilities clearly in each layer as I have outlined. For a small scale project, you could go with your approach.
    2. Whats the take on maintenance and future add-ons ? Do you see the codebase growing with time ?
    3. Is your project a commercial one - is it a product that needs to be maintained or is it a one-off development - develop once and you are done with it.
    4. What are the design considerations ? Is somebody going to audit code for quality ? Or is it a academic one ?
    You should take into account all these before deciding to go one way or the other.
    A general thumb rule should be that you should be convinced that your code readable (maintainable), scalable and efficient. Anything that you do towards these ends is good code/design despite what people/books/patterns say, IMO.
    cheers,
    ram.

  • Change where clause filter based on prompt?

    Hi,
    I am trying to change my where clause filter based on a prompt selected. What I want to do logically looks like this - although it doesn't work as it is not valid case statement syntax:
    select *
    from table t
    where t.calc_result_info_key in (case when :product_prompt = 'GAS' then (310, 160, 4000)
                                     else (320, 330, 340, 350, 170, 180, 190, 200, 4010, 4020, 4030, 4040)  end)Is there any way to change filter logic like this?
    Edited by: dgouin on Sep 16, 2010 9:02 AM

    The good old ugly OR statement.
    select *
    from table t
    where
          t.calc_result_info_key in (310, 160, 4000)
             and
          :product_prompt = 'GAS'
       or
          t.calc_result_info_key in (320, 330, 340, 350, 170, 180, 190, 200, 4010, 4020, 4030, 4040)
       and
          (:product_prompt != 'GAS' or :product_prompt is null)
       )

  • How To change the ADF View Object  query where-clause at RunTime?

    I am trying to create a simple display page which will display user data (username, assoc_dist_id, assoc_agent_id, status , etc). The User data is stored in a database table and i am using an ADF Read Only table based on the View Object to display the data on the JSF page.
    However, i want to display only the users that a particular person accessing the page has the AUTH LEVEL to see. e.g. If the person accessing the page is an 'ApplicationAdministrator' then the page should display all users in the table, If its a 'DistributorAdministrator' then the page should display only users associated with that Distributor (i.e. assoc_dist_id = :p_Dist_id ) and If its an 'AgentAdministrator' , then the page should display only users associated with that Agent ( i.e. assoc_agent_id = :p_Agent_id).
    Currently my af:table component displays all the users in the table because the query for the view object is (select * from users) . However, i want to use the same viewobject and just set the where-clause at runtime with the appropriate parameter to restrict the dataset returned.
    Do anyone knows how to accomplish this ?

    David,
    See the custom method initializeDynamicVariableDefaults() in the SRViewObjectImpl.java class in the FrameworkExtentions project in the SRDemoSampleADFBC sample application. You can find out how to install the demo if you haven't already from the ADF Learning Center at:
    http://www.oracle.com/technology/products/adf/learnadf.html
    This class is a framework extension class for view objects that adds a neat, generic feature to be able to dynamic default the value of named bind variables. You can read more about what framework extension classes are and how to use them in Chapter 25, "Advanced Business Components Techniques" of the ADF Developer's Guide for Forms/4GL Developers, also available at the learning center above.
    It is an example of generic framework functionality that "kicks in" based on the presence of custom metadata properties on a named bind variable. See section 25.3.3 "Implementing Generic Functionality Driven by Custom Properties" in the dev guide for more details. Using this sample code, if you add a bind variable to a view object, and define a custom metadata property named "DynamicDefaultValue" on that bind variable, and set this custom metadata property to the value "CurrentUser", then that bind variable will have its value dynamically defaulted to the name of the authenticated user logged in. If instead you set this custom property to the value "UserRole", then the bind variable will be set to the comma-separated string containing the list of roles that the authenticated user is part of.
    Once you've created a framework extension class for view objects like this, you can have the view objects you create inherit this generic functionality.See section 25.1.4 "How to Base an ADF Component on a Framework Extension Class" in the dev guide for more info on this.
    By adapting a technique like this (or some idea similar that better suits your needs) you can have your view object query contain bind variables whose values automatically take on the defaults based on something in the user-session environment.

  • ADF/UIX where clause and VO on different pages

    Hi,
    i have a VO called Periods which contains Periods and their statuses. On one page for entering data i use the periods VO in LOV mode with a where clause limiting the user to selecting periods with open status.
    I have another page which is for maintaining the period statuses. The problem is that when i move between entry and setup pages the where clause takes affect in both pages ie. the maintain periods page only shows periods with status Open!!
    To get around this on the maintain periods prepare model i tried doing this:
    actionContext.getBindingContainer().getApplicationModule().findViewObject("PeriodsView1").setWhereClause(null);
    actionContext.getBindingContainer().getApplicationModule().findViewObject("PeriodsView1").executeQuery();this works, however it causes bizarre behaviour on some records when i change values in the UIX editable table. The UIX editable table works fine if i remove the above code snippet (and dont go to the page that sets the where clause on the view object). The behaviour is that i cant select some rows in the UIX table properly and the updated values arent effected.
    can someone advise pn the proper way of doing this?

    Brenden, instead of setting the where clause to null, try setting it to an empty string (eg. "") or something dumb like "1=1".
    In turn place JDeveloper into debug mode by selecting your project properties, profiles, development, runner, and changing the java options to: -Djbo.debugoutput=console
    With this option turned on, you'll see your actual SQL going to the database with your where clause. You should be able to see the where clause of your underlying query that you just set, and if you use something dumb like 1=1 you'll note the setWhereClause module is working.
    Hope this helps.
    Cheers,
    CM.

  • ADF BC View Objects: Disappearing where clauses

    Playing around with the 11g Technical Preview I find out that sometimes the where clauses - added to View Objects by means of the new "Join Type" field in the VO-editor UI - disappear.
    I'm not able to reproduce exactly and "on demand", but it seems to happen when the sources of more than one View Object are open simultaneously and/or the XML definition of a View Object is edited directly on the Source-tab.

    Today I succeeded in reproducing:
    Two tables:
    TAB_MASTER:
    ID NUMBER NOT NULL
    DESCRIPTION VARCHAR2 NOT NULL
    TAB_DETAIL:
    ID NUMBER NOT NULL
    MASTER_ID NUMBER NOT NULL
    DESCRIPTION VARCHAR2 NOT NULL
    TAB_DETAIL.MASTER_ID is a foreign key referencing TAB_MASTER.ID.
    Steps to reproduce:
    1. Generate default ADF BC objects from database tables.
    2. Open definition of TAB_DETAIL View Object.
    3. Go to the Entity Objects tab
    4. Add TAB_MASTER Entity Object to the Selected Entities Objects. Association and Join Type are filled in automatically.
    5. Go to the Query tab and go to SQL tab in de Property Inspector. Where clause is filled.
    6. Go to the Attributes tab and click Add from Entity...
    7. Add TAB_MASTER.DESCRIPTION attribute.
    8. Again, go to the Query tab and go to SQL tab in de Property Inspector. Where clause is still filled.
    9. Go to the Attributes tab and select MASTER_ID attribute.
    10. Click icon to add List Of Values
    11. In List Of Values dialog add View Object TAB_MASTER and add the correct pairs of List Return Values for the ID and (MASTER) DESCRIPTION attributes.
    12. After completing the List Of Values dialog go to the Query tab -> SQL tab again. The where clause added to join the Entity Objects (see step 5.) is cleared, resulting in a wrong SQL statement for the View Object.

  • DM3.0 EA2: Filter engineering changes between logical and relational model

    Hi,
    when I am engineering changes between logial and relational model there are some issues at filter handling for me:
    - When the filter "Show Modified Objects" is activated, the filter works only on the first level, e.g. on Entity level. On attribute level all attributes are displayed, not only the attributes which have really been modified. It is possible, to show on every level only the really modified objects?
    - I think, selecting a Filter condition is circuitous. All filter conditions except "Show All Objects" keeps activated when I choose another condition. So I have to deactivate "Show Deleted Objects" when I want to see only the modified objects. It is possible to choose another control element for filtering, e.g. disjunctive radio buttons?
    I am running Data Modeler on Windows XP with german localization and the JDK 1.6.0_11 from Oracle SQL Developer.

    I logged bug for that.
    Philip

  • Filter Records in WHERE clause iReports using values passed from a prgram

    I have searched for iReports manual and what i can see are docs on sale. I have managed to create jrxml file, execute it in jsp and actually view the report.
    Now i have a big list of customers from various branches and have various categories. I would like to know how to pass the parameters so that i retrieve a small list of items. e.g. WHERE cu.branch=200 AND cu.category=10. That is i would like to pass 20 and 10 to the jrxml query stored.
    In iReports i saw parameters, variables and fields but it seems like these are displayable fields.
    How will i achieve this. Am seeking for assistance.
    null

    >
    Please help me to use an associate array in SQL query (WHERE clause).
    select *
    bulk collect into some_array
    >
    there is no variable 'some_array' in what you posted.
    If you want help with your code you have to post the code you are really using, not some hacked-up version of it that has errors.
    Here is sample code that shows how to treat a collection as a table using the TABLE operator
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    declare
    tb emp_table_type;
    deptnoList sys.OdciNumberList;
    BEGIN
    select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
    bulk collect into tb from emp;
    SELECT deptno bulk collect
    INTO deptnoList
    FROM dept where deptno not in (select deptno from table(tb));
    for i in 1..deptnoList.count loop
    dbms_output.put_Line(deptnoList(i));
    end loop;
    END;Note that tb is a collection and is useds in the subquery 'select deptno from table(tb)'.

  • LTS content WHERE clause and fitlers screwing up returned data

    Hi all,
    I'm connecting against Essbase 9.3.1 cubes with 10.1.3.4 and just stumbled upon an error. In some of the dimensions coming from Essbase there are undesired members, which I wanted to filter out the usual way. I.e. by adding where clauses to the LTS:
    "Cube#1"."SALES".."SALES"."Gen4,Market" <> 'Dummy'
    Now before doing this, everything runs fine with one report yielding this:
    Gen3,Product Range
    A 6.4
    B 4
    C 7.2
    After adding:
    Gen3,Product Range
    A 35
    B 110
    C 42
    These numbers don't make any sense. Funny thing is, that the request doesn't even display the Market dimension.
    So I thought "well let's put it on the reports then". So I created saved filters (since there's also one on products)...Same result.
    It actually appends this to the MDX
    *set [Market4] as 'Filter(Generate({[Market3]}, Descendants([Market].currentmember, [Market].Generations(4),SELF), ALL), ( NOT ([Market].currentmember.MEMBER_ALIAS = "Corporate Sub-Region" OR [Market].currentmember.MEMBER_Name = "Corporate Sub-Region")) AND ( NOT ([Market].currentmember.MEMBER_ALIAS = "European Region SRgn" OR [Market].currentmember.MEMBER_Name = "European Region SRgn")))'*
    The thing is: if I only use market dimension levels and filtering there I'm fine. Likewise, if I only use product dimension levels and filter on products there's no issue.
    Any idea how I can filter this without getting errors?
    Here's the two full statements
    WORKS:
    With
    set [Data Type2] as 'Filter([Data Type].Generations(2).members, ([Data Type].currentmember.MEMBER_ALIAS = "Units" OR [Data Type].currentmember.MEMBER_Name = "Units"))'
    set [Market3] as 'Filter([Market].Generations(3).members, ([Market].currentmember.MEMBER_ALIAS = "Europe" OR [Market].currentmember.MEMBER_Name = "Europe"))'
    set [Product2] as 'Filter([Product].Generations(2).members, ([Product].currentmember.MEMBER_ALIAS = "SMU" OR [Product].currentmember.MEMBER_Name = "SMU"))'
    set [Product3] as 'Generate([Product2], Descendants([Product].currentmember, [Product].Generations(3), leaves))'
    set [Time Period2] as 'Filter([Time Period].Generations(2).members, ([Time Period].currentmember.MEMBER_ALIAS = "FY-09" OR [Time Period].currentmember.MEMBER_Name = "FY-09"))'
    set [Time Period3] as 'Generate({[Time Period2]}, Descendants([Time Period].currentmember, [Time Period].Generations(3),SELF), ALL)'
    set [View Type2] as 'Filter([View Type].Generations(2).members, ([View Type].currentmember.MEMBER_ALIAS = "Default" OR [View Type].currentmember.MEMBER_Name = "Default"))'
    member [Account].[MS1] as 'AGGREGATE(crossjoin ({[Data Type2]},crossjoin ({[Market3]},{[View Type2]})),Account.[WoH Last 13Wks])', SOLVE_ORDER = 100
    member [Account].[MS2] as 'AGGREGATE(crossjoin ({[Data Type2]},crossjoin ({[Market3]},{[View Type2]})),Account.[WoH Last 4Wks])', SOLVE_ORDER = 100
    select
    { [Account].[MS1],
    [Account].[MS2]
    } on columns,
    NON EMPTY {crossjoin ({[Product3]},{[Time Period3]})} properties ANCESTOR_NAMES, GEN_NUMBER on rows
    from [SALES.SALES]
    DOESNT WORK:
    With
    set [Data Type2] as 'Filter([Data Type].Generations(2).members, ([Data Type].currentmember.MEMBER_ALIAS = "Units" OR [Data Type].currentmember.MEMBER_Name = "Units"))'
    set [Market3] as 'Filter([Market].Generations(3).members, ([Market].currentmember.MEMBER_ALIAS = "Europe" OR [Market].currentmember.MEMBER_Name = "Europe"))'
    set [Market4] as 'Filter(Generate({[Market3]}, Descendants([Market].currentmember, [Market].Generations(4),SELF), ALL), ( NOT ([Market].currentmember.MEMBER_ALIAS = "Corporate Sub-Region" OR [Market].currentmember.MEMBER_Name = "Corporate Sub-Region")) AND ( NOT ([Market].currentmember.MEMBER_ALIAS = "European Region SRgn" OR [Market].currentmember.MEMBER_Name = "European Region SRgn")))'
    set [Product2] as 'Filter([Product].Generations(2).members, ([Product].currentmember.MEMBER_ALIAS = "SMU" OR [Product].currentmember.MEMBER_Name = "SMU"))'
    set [Product3] as 'Generate([Product2], Descendants([Product].currentmember, [Product].Generations(3), leaves))'
    set [Time Period2] as 'Filter([Time Period].Generations(2).members, ([Time Period].currentmember.MEMBER_ALIAS = "FY-09" OR [Time Period].currentmember.MEMBER_Name = "FY-09"))'
    set [Time Period3] as 'Generate({[Time Period2]}, Descendants([Time Period].currentmember, [Time Period].Generations(3),SELF), ALL)'
    set [View Type2] as 'Filter([View Type].Generations(2).members, ([View Type].currentmember.MEMBER_ALIAS = "Default" OR [View Type].currentmember.MEMBER_Name = "Default"))'
    member [Account].[MS1] as 'AGGREGATE(crossjoin ({[Data Type2]},crossjoin ({[Market4]},{[View Type2]})),Account.[WoH Last 13Wks])', SOLVE_ORDER = 100
    member [Account].[MS2] as 'AGGREGATE(crossjoin ({[Data Type2]},crossjoin ({[Market4]},{[View Type2]})),Account.[WoH Last 4Wks])', SOLVE_ORDER = 100
    select
    { [Account].[MS1],
    [Account].[MS2]
    } on columns,
    NON EMPTY {crossjoin ({[Product3]},{[Time Period3]})} properties ANCESTOR_NAMES, GEN_NUMBER on rows
    from [SALES.SALES]

    NLS is UTF8 btw.

  • Using bind variable in dynamic where clause and concatenate with query

    Hi,
    In my procedure i am framing where clause dynamically with bind variable,When i am concatenate this with my sql query for REF CURSOR i got sql command not properly ended exception.
    Is it possible to pass values to the bind variable through the dynamic variable/value?
    Please advise
    Thanks in advance
    Siva
    IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
    My query is like this
    open Out_Main FOR SelectQuery USING optional_using

    Thanks for reply,
    In my procedure, i suppose to frame the where clause with bind dynamically according to the input parameters. so that i am framing the values of the bind variables also dynamically like this,
    Please advise...
    IF in_assignedAppFlag IS NOT NULL THEN
              IF in_assignedAppFlag = 'Y' THEN
                   optional_where := optional_where || ' AND b.ASSIGNED_TO = :b' ;
              optional_using := ' in_appFuncGroup'||',in_currentUserID';          
              ELSe
                   IF in_isSupervisor = 0 THEN
                        optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID';
                   END IF;
              END IF;
         ELSE
              IF in_isSupervisor = 0 THEN
                   optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
                   optional_using := ' in_appFuncGroup'||',in_currentUserID';
              END IF;
         END IF;
         IF in_appFuncGroup IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_FUNC_GROUP= :c';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup';
         END IF;
         IF in_queue_id IS NOT NULL THEN
              optional_where := optional_where || ' AND b.QUEUE_ID = :d';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id';
         END IF;
         IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
         IF in_sourceCode IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_SOURCE_CODE like '||':f%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode';
         END IF;
         IF in_logo IS NOT NULL THEN
              optional_where := optional_where || ' AND appProds.PRODUCT_TYPE like '||':g%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo';
         END IF;
         IF in_firstName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.FIRST_NAME) like upper(:h%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName';
         END IF;
         IF in_surName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.SURNAME) like upper(:i%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName';
         END IF;
         IF in_retreival_id IS NOT NULL THEN
              optional_where := optional_where || ' AND e.RETREIVAL_ID like :j%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName'||',in_retreival_id';
         END IF;

  • How to use a lexical variable in a WHERE clause and as a function argument.

    Hello,
    My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
    .. where date is not null &var;
    In the second query, the variable is used in a function call, something like:
    select * from table (my_function(&var));
    The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
    Does anyone have an idea how I could solve this problem?
    Thanks in advance,
    Frans
    Message was edited by:
    fransie

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Presents many options.

  • Where clause and using dates

    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneem

    Tasneem wrote:
    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneemtry this..
    select items from inventory_items
    where purchasing_date between :from_date and :to_date;
    If someone's response is helpful or correct, please mark helpful or correct.

  • Where clause and joins

    HI all,
    If i Have a select statement that needs two different tables
    and a where clause with only 1 join and the rest of conditions dependent on only 1 table such as:
    select .... from table a, table b
    where a.col1 = b.col1
    and b.col2 some condition
    and b.col3 some condition;
    is it better/optima for performancel for me to have the join right at the beginning of the where clause or after table b has been filtered out such as:
    select ... from table a, table b
    where b.col2 some condition
    and b.col3 some condition
    and a.col1 = b.col1

    Hi,
    The order of conditions in a WHERE clause doesn't effect performance; the Cost-Based Optimizer will decide how to perform them.
    The order can make a difference on how easy it is to understand and maintain the code. I find ANSI join syntax far better for this:
    select      ...
    from      table      a
    join     table      b     on     a.col1     = b.col1
    where      b.col2  <some condition>
    and      b.col3  <some condition>
    ;

  • Where clause and Dates

    I am creating a coditional query for one of my data blocks.
    What I need to do is build a where clause on the fly and pass
    that back to my block using the Set_BLock_Property built in. I
    am able to do this but I am having problems with the fact that I
    don't know how to correctly pass a date back. It seems when
    specifying a date in a where clause it needs to have single
    quotes around this. But when ever I try to embed the quotes in
    the string I am not successful. I have even tried appending the
    quotes using the chr function doing something like.
    Where_Clause := 'Birthday <= '

    Spencer,
    I think chr(39) will give you the correct character. For example,
    Where_Clause := 'Birthday <= '

Maybe you are looking for

  • How can I get passed the set up page?

    I used Time machine from my old computer and used the external hard drive to plug in my new pro. I'm not sure if I just had a lot to put on the pro that it is taking so long, but it's been sitting on the "Thank You. Your Mac is set up and ready to us

  • Runtime Error while summing a column in ALV output

    Dear All, I have developed an ALV Report and the report is giving output without any flaws. I have defined proper field catalog and displaying the results using REUSE_ALV_GRID function module. Now the report is generating Runtime Error while the user

  • How do I correct a Double NAT status?

    I have used time capsule 2TB for a while, made changes many times,never had a problem but today after I made changes it is giving me a blinking amber light from the time capsule unit and from the airport wireless utility status "Double NAT". How can

  • Customization of the Survey App to create a poll webpart

    Hello All, I need to display the Poll question on the home page. I used the normal Survey webpart to do it. but it displays the survey description on the page with a "Respond to the Survey" link. Once I click on that link, it redirects me to a page t

  • When calling my contacts I get connected to wrong numbers.  Other times my phone will call the contact

    When I call my contacts I get connected to wrong numbers.  Other times the phone rings & connects but silent on my end & the other party sees that I called but not connected.