Condition Query

Hi all,
i have created a condition Query to have only negative turnover values. Is it posible to have a total sum of only these negative turnover values? the general total i am having in my Query is of both the negative and positive turnover sum up together. Can someone sort me out with this.
Thanks alot.

Hi,
create 2 querys,
1) one is for general  (negative & positive values)
2)  query for only negative values with condition,
insert both the querys in a Report designer report,
in report designer after u inserted the second query, just keep the result row and delete the other rows and execute. it will show you the sum of negative values without displaying the individual rows
Regards
ReddY A

Similar Messages

  • Error While Creating Date type condition query

    Hi All,
    I am getting following error while creating a multiple condition query.
    ERROR:java.lang.IllegalArgumentException: Unexpected field type for D: java.lang.String
    I am pasting the scrap of the code for review below.
    pls note after removing the condition cond6; it works fine, and cond6 is for date type field.
    for(int j=1;j<7;j++){                          
    fd[j] =trd.getFieldDescriptor(arrayHeaderFieldNames[j]);
    BasisFieldType bft1 =  fd[j].getFieldType();
    if (bft1 == BasisFieldType.C) {
      filterOperator[j] = RelationalOperatorType.CONTAINS;       }
    else{
      filterOperator[j] = RelationalOperatorType.EQUALS;
    order[j] =queryFactory.createSortOrder(fd[j],true);
    cond1 =queryFactory.createCondition(fd[1], filterOperator[1], values[0]);
    cond2 =queryFactory.createCondition(fd[2], filterOperator[2], values[1]);
    cond3 =queryFactory.createCondition(fd[3], filterOperator[3], values[2]);
    cond4 =queryFactory.createCondition(fd[4], filterOperator[4], values[3]);
    cond5 =queryFactory.createCondition(fd[5], filterOperator[5], values[4]);
    cond6 =queryFactory.createCondition(fd[6], filterOperator[6], values[5]);
    Condition cond = queryFactory.createCondition(new Condition[]{cond1,cond2,cond3,cond4,cond5,cond6},LogicalOperatorType.AND);
    Please Help!
    Thanks n regards,
    Kapoorchand.

    Hi,
    well that problem is a long time back -. I only have in mind that the date I had to transfer to the quesry was in a "strange" format. Have a lock into the documentation for the date field - your date field is not recognised as a date field from the quesry engine and so this fails - but unfortunately I have no idea at the moment how I fixed it last time - how I converted my date field......
    Sorry, thast I can not give you the real point - but I will have a lock into the old code - hopefully I find it soon.
    Regards,
    Oliver

  • Need help with conditional query

    guys this is just an extension of this post that Frank was helping me with. im reposting because my requirements have changes slightly and im having a hell of a time trying to modify the query.
    here is the previous post.
    need help with query that can look data back please help.
    CREATE TABLE "FGL"
        "FGL_GRNT_CODE" VARCHAR2(60),
        "FGL_FUND_CODE" VARCHAR2(60),
        "FGL_ACCT_CODE" VARCHAR2(60),
        "FGL_ORGN_CODE" VARCHAR2(60),
        "FGL_PROG_CODE" VARCHAR2(60),
        "FGL_GRNT_YEAR" VARCHAR2(60),
        "FGL_PERIOD"    VARCHAR2(60),
        "FGL_BUDGET"    VARCHAR2(60)
      )data
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');
    I need to find the greatest grant year for the grant by a period parameter.
    once i find the greatest year i need to check the value of period 14 for that grant for the previous year and add it to the budget amount for that grant. however if their is an entry in the greatest year for period 00 then i need to ignore the period 14 of previous year and do this calculation current period +(current period - greatest year 00)
    hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
    because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
    period 2 amount $ 600
    period 0 amount $ 400 - period 2 amount of $600 = 200
    600+200 = $800
    if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
    i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
    can you please help me out.
    here is the query supplied by frank kulash who gracefully put this together for me.
    WITH     got_greatest_year     AS
         SELECT     fgl.*     -- or whatever columns are needed
         ,     MAX ( CASE
                     WHEN  fgl_period = :given_period
                     THEN  fgl_grnt_year
                    END
                  ) OVER ()     AS greatest_year
         FROM     fgl
    SELECT     SUM (fgl_budget)     AS total_budget     -- or SELECT *
    FROM     got_greatest_year
    WHERE     (     fgl_grnt_year     = greatest_year
         AND     fgl_period     = :given_period
    OR     (     fgl_grnt_year     = greatest_year - 1
         AND     fgl_period     = 14
    ;Miguel

    Hi, Miguel,
    Are you waying that, when the greatest year that has :given_period also has period='00' (or '0', or whatever you want to use), then you want to double the budget from the given_period (as well as subtract the budget from the '00', and not count the pevious year's '14')? If so, add another condition to the CASE statement which decides what you're SUMming:
    WITH     got_greatest_year     AS
         SELECT       TO_NUMBER (fgl_grnt_year)     AS grnt_year
         ,       fgl_period
         ,       TO_NUMBER (fgl_budget)     AS budget
         ,       MAX ( CASE
                       WHEN  fgl_period = :given_period
                       THEN  TO_NUMBER (fgl_grnt_year)
                      END
                    ) OVER ()     AS greatest_year
         FROM       fgl
    ,     got_cnt_00     AS
         SELECT     grnt_year
         ,     fgl_period
         ,     budget
         ,     greatest_year
         ,     COUNT ( CASE
                       WHEN  grnt_year     = greatest_year
                       AND       fgl_period     = '00'
                       THEN  1
                         END
                    ) OVER ()          AS cnt_00
         FROM    got_greatest_year
    SELECT       SUM ( CASE
                        WHEN  grnt_year     = greatest_year                    -- New
                  AND       fgl_period     = :given_period                    -- New
                  AND       cnt_00     > 0            THEN  budget * 2     -- New
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = :given_period       THEN  budget
                        WHEN  grnt_year     = greatest_year
                  AND       fgl_period     = '00'            THEN -budget
                        WHEN  grnt_year     = greatest_year - 1
                  AND       fgl_period     = '14'     
                  AND       cnt_00     = 0            THEN  budget
                    END
               )          AS total_budget
    FROM       got_cnt_00
    ;You'll notice this is the same as the previous query I posted, except for 3 lines maked "New".

  • Regarding Pricing conditions Query

    Hi,
    I am planning to extract the table wise information on the exiting pricing condtions available in the production environment.
    Below is the plan
    obtain the latest condition record number(valid as on date) from A*** ( access sequence tables for prices) with appropriate condition types.
    pass these condition record numbers to KONP table & fetch the conditional value along with the currency.
    the problem i now have is that am not able to do a table join for the tables A**, Table A** cannot be used in a Join.
    what are the alternates available, Note i cant  have SE16N or SE16 authorization in production environment & i prefer to have a query or using SQVi

    Hi Ilango,
    You can use the pricing report to list all the condition records.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90637622-7289-2c10-a3bb-f94d9fa4a5e8?quicklink=index&overridelayout=true
    Please refer to the below document on the steps to configure a pricing report.
    Hope this helps you in generating all the condition records.
    Thanks
    Arun

  • Condition - Query Designer not working in BEx

    Hi all,
    I have used Condition in my Query in Query designer. it is to calulate the top 10 customer. when i execute the report in RSRT , condition is not working properly.
    But, at the same time , i am executing my same query on portal and condition is working on portal.
    We are on EHP 1 . please suggest.
    Regards,
    Macwan James.

    Hi James,
    There are certain functions about condition which are only available for 7.x runtime (Java Web, Portal) and are not available for 3.x runtime (transaction RSRT, BEx Analyzer, ABAP Web).
    For example this one:
    http://help.sap.com/saphelp_nw70/helpdata/en/43/2695d2fd2f0d23e10000000a1553f7/frameset.htm
    ●      Most Detailed Characteristic Along the Rows or Columns
    This option is optimized for threshold value conditions. The condition is applied to the most detailed characteristic of the rows or columns.
    Note that this function is not supported when executing the query in the BEx Analyzer.
    If you have set to "Most Detailed Characteristic Along the Rows or Columns" in Query Designer, portal would execute properly according to this setting while RSRT would use one of the other two settings (seems to be "Single Characteristics and Characteristic Combinations" as I remember) which lead to unexpected result. This is my assumption how it is in your case.
    Regards,
    Patricia

  • Multiple condition Query

    Hello
    I have a result of Query like this:
    Col1 Col2 Col3
    T1 15 20
    T1 18 19
    T1 5 20
    T2 15 20
    T2 18 19
    And I just need to display only the T's that would meet the condition Col2 in (15,18) and Col3 in (20,19).
    I try with a condition where col2 in (15,18) and col3 in (20,19) and that works, but I don't need to display T1, because T1 has a Col2=5 and Col3=20, I just have to display T2 that just satisfies all my conditions, Col2 in (15,18) and Col3 in (20,19). It's something like a vertical search.
    How can I do it?

    Welcome to the forum!
    Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, and also post the results you want from that data. You should explain how you get the results, as you did, but explain them in addition to, not instead of posting them.
    Always say which version of Oracle you're using.
    Since this is your first message, I'll post the sample data for you:
    CREATE TABLE     table_x
    (     col1     VARCHAR2 (5)
    ,     col2     NUMBER (2)
    ,     col3     NUMBER (2)
    INSERT INTO table_x (col1, col2, col3) VALUES ('T1', 15, 20);
    INSERT INTO table_x (col1, col2, col3) VALUES ('T1', 18, 19);
    INSERT INTO table_x (col1, col2, col3) VALUES ('T1',  5, 20);
    INSERT INTO table_x (col1, col2, col3) VALUES ('T2', 15, 20);
    INSERT INTO table_x (col1, col2, col3) VALUES ('T2', 18, 19);
    COMMIT;I think (but I'm not sure) the results you want are just the col1s that always meet the conditions:
    COL1
    T2You can get these results with MINUS, but it requires two passes through the data. It will be more efficient to get all the information you need in one pass, like this:
    SELECT       col1
    FROM       table_x
    GROUP BY  col1
    HAVING       SUM ( CASE
                   WHEN  col2 IN (15, 18)
                   AND   col3 IN (19, 20)
                   THEN  0
                   ELSE  1
              END
               ) = 0
    ;If you want the results that Skud posted, then you can do something similar, using the analytic SUM function instead of the aggregate SUM.
    Can col2 or col3 be NULL? If so, post some sample data and results where they are.
    This query will work in Oracle 8.1 (and higher).

  • Creating a conditional query for alert

    Hope someone can help with this, I am trying get an SQL query to work in an alert that returns a sales quotation number based on UDF's in the record. The basic query is:
    SELECT     DocNum, CardCode, CardName
    FROM         OQUT
    WHERE     (U_PLApr = 'I') AND (CANCELED = 'N') AND (DocStatus = 'O')
    AND
    IF (U_CableCk = 'Y') AND (U_CAApr = 'C') AND
    IF (U_Electrical = 'Y') AND (U_ELApr = 'C') AND so on...
    In this example, if U_cableck = 'N' I want to ignore that part, and check U_Electricalck = 'Y' and U_elapr='C'.
    To put it more simply, if the first condition is Y, then check to see if the second is 'C'. If all cases are true, then return the data fields.
    There are about 8 conditions within the OQUT record like this. I could write a large number of selects with AND and OR statements to cover all possible combinations, but am looking for a better way.
    I have tried writing case statements into my query, but nothing is working.
    Any help is much appreciated

    Suda, tried the query this way:
    SELECT docnum, CardCode, Cardname from OQUT where  U_PLApr = 'I'  and canceled = 'N' and docstatus = 'O'  and ((U_cableck = 'Y') and (U_CAApr = 'C')) and ((U_electricalck='Y') and (U_ELApr='C'))
    If U_cableck <> Y, or U_electricalck <> Y, the query returns no results, when it should show results. Only when all the vales are Y and C does the query give results. Which is not always the case.
    The possible data here is:
    U_Cableck    U_CAApr     U_Electrical      U_ELApr        Should have Result
    Y                      C                   Y                     C             Yes
    Y                      I                     Y                     I               No
    Y                      C                   N                     I              Yes
    Y                      I                     N                     I               No
    N                      I                     Y                     C             Yes
    N                      I                     Y                     I               No
    N                      I                     N                     I               No
    Y and N represent Yes and No - whether or not the user needs to approve
    C and I represent Complete and Incomplete - the user changes incomplete to complete if they are Yes in the first UDF.
    Hope this helps it make sense, may not be possble to test the data this way. Thanks

  • Purchase Order new condition query

    Hello Experts,
    I am adding a new condition (FRB1) type to a purchase order smartform. I have changed the print flag in T683S to display this at item level which it does ok. However the value from this condition was not added to the total.
    I'm assuming I need to tell SAP that I want the condition value adding to the total but how do I do that?
    Best Regards
    MikeSpear

    Hi All,
    Plz help guys.

  • Shipping condition query

    Hi
    I have a question regarding shipping condition. This shipping condiion field is fetched from sold to party or from order type(if assignment is there with order type). If assignment with order type is there then this will take precedence over sold to party. However this same field (shipping condition)is given in ship to party account group too, so my question is what is the significance of this shipping condition field in ship to party account group? I had replicated a scenario where I removed the mandatory field shipping condition was made optional in sold to party account group and at the same time did not made any assignment with order type, I maintained the shipping condition with ship to party and did not maintain the shipping cond with sold to party. Once i created the order the order showed incompletion and no shipping data was determined(i.e. I could not save the order), so my question is even though shipping condition was maintained in ship to party then why did not it flow in the sales order and what is the significance of this field in ship to party?

    Hi Abhishek
    "Shipping condition " first system searches from the "Sales document type"  and if not found then only it takes from the customer master fo "Sold-to-party".
    Though Shipping condition is there in the customer master of SH , but it is not considered.
    In "Standard order (OR)", you will not find any "Shipping condition". I mean Shipping condition field is blank.
    So whenever, you create a Standard order, system takes the Shipping condition from the Sold-to-party only.
    But, if will go for "Cash Sale" i.e, CS, you will find Shipping condition "Immediately (10)".
    Moreover in Cas Sale, you do not have customer master data of the Sold-to-party with you, so where from system will get the "Shipping condition".
    Whereas "Shipping condition" is a mandatory data otherwise Shipping point can not be determined and you can not deliver also.
    Therefore, in "Cash Sale" Shipping condition is taken from the "Sales docuiment type", whereas in "Standard order" Shipping condition is taken fronm the Sold-to-party.
    One more thing, try to understand the field Shipping condition. If you will go to the drop down , you will find Shipping condition like "As soon as possible" , "Immedaitely" etc.
    Who tells you when order is placed? You think yourself as an end user and say.
    Obviously, Sold-to-party tells you.
    Similary, Price also you negotiate with the SP, that is why, Shipping condition, Price etc are taken from Sold-to-party.
    Similarly, Delivery address, Plant etc normally taken from SH .
    Similarly, Payment term,Credit limit etc taken from the PAYER, though you may find these fields in the master data of SP  and SH  also.

  • POP UP  inside a report: conditional query based on other col el. values

    HI to all,
    i've a really simple question: is there a way inside a pop up in a report, to refer to other columns value (of the same row)?
    I'm giving my example:
    i've a table called CNT_VAL_SEG_DEMO
    id
    des
    value
    value have to be a pop up LOV, query based:
    the pseudo sql code is this:
    SELECT DISTINCT VALUE V1 , VALUE V2 FROM CNT_VAL_SEG_DEMO WHERE
    des=<pseudo code>#DES#<pseudo code>.
    What should i use instead of #DES#
    Hope that is clear enough
    thanx a lot

    Hi,
    i think i've found the solution on htmldb studio.
    Doesn't matter.
    However for pointing who's reading
    to the right direction:
    http://htmldb.oracle.com/pls/otn/f?p=18326:54:3063779097888583::::P54_ID:1282
    Tips and tricks: Simulating a correlated sub report in Lov
    Thanx a lot
    Message was edited by:
    Marcello Nocito

  • Where Condition Query Help

    I have a table with following data
    I need help in my where condition
    ID         Number   Token
    12100       V33     09
    12103       V66     03
    12103       V66     09
    12105       V77     09
    12106       V88     03
    12106       V88     09
    I want to put Token in Where condition like this
    If Token is only 3 for that ID then It will show following records
    ID         Number   Token
    12103       V66     03
    12106       V88     03
    If User asks for Token 09 record then It will exclusively show record  with 09 with not with 03 and with 09 records
    So Output will be like this
    ID         Number   Token
    12100        V33     09
    12105       V77     09

    hi,
    try this,
    select
    from tokenid
    where
    token = 09
    and
      number not
    in(select
    number  from tokenid
    where
    token = 03
    GVRSPK VENI

  • Conditions for results row in query

    Hi,
    I've query with conditions. Let us say without conditions query result has 10 records. But After applying conditions result has 4 records.
    When you check the result row the subtotals and totals are coming wrong. Result rows are considering the 10 records.
    How can I get the result row has to consider only those 4 records after conditions.

    Hi,
    I have the same problem. And I didn't find any solution.
    kind regards
    Tobias

  • How to fire sql query conditionally?

    Hi all,
    I want a select query to fire conditionally.
    for example
    I want this:
    select case when &a>2 then
    select 2 from dual
    else when &a<2 then
    select 3 from dual
    end
    from dual;
    when variable a is greater than 2 then "select 2 from dual" query will fire
    and when variable a is less than 2 the "select 3 from dual " query will fire.
    how to do this?

    RMukherjee wrote:
    hi...my question is not about selecting 2 or 3
    its about firing query selectively
    that is
    select case when condition then
    select something from some table ---- this query will fire --query 1
    when condition
    select something from some table ---this query will fire--query 2
    end
    from dual;
    depending on the condition, query 1 or 2 will fire.No, that is one whole query, there is no query 1 or query 2.
    SQL is not a conditionally executing language. You consruct a whole query and you execute a whole query.
    Sure, you could get the query to call functions, or a pipelined function etc. which could use PL code to conditionally execute some query and return data appropriately, but that's introducing seemingly unnecessary context switching.
    So what is the actual problem that you are trying to solve? Rather than ask how to fix a clearly broken solution, it's better you explain what you are trying to achieve in the first place.

  • Can I put confitions in a query?!?

    Hi there,
    Can anybody tell me if there could have something like a conditional query?
    Ok here is the deal.. I have couple of tables where i have the relations between objects, subobjects and sub-subobjects and the status of the sub-subobjects.
    One object can have many subobjects with many sub-subobjects with different status
    object
    - subobject1
    -sub-subobject1
    -sub-subobject1
    I m trying to build a tree which shows img for the status of the subobjects and sub-subobjects.
    The idea is if any of the sub-subobject is "URGENT" the status for the Subobject to this subsubobject to be "URGENT" too.
    How can I make my tree query work like this?
    Any help will be highly appreciated!
    Thanks in advance

    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 25 16:17:01 2007
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    macmilp@xe > with t as (
      2    select 0 id, null parent, 'UK' node, null status from dual
      3    union
      4    select 1, 0, 'Scotland', null from dual
      5    union
      6    select 2, 0, 'Wales', null from dual
      7    union
      8    select 3, 1, 'Fife', 2 from dual
      9    union
    10    select 3, 1, 'Aberdeen', 2 from dual
    11    union
    12    select 4, 1, 'Edinburgh', 1 from dual
    13    union
    14    select 5, 2, 'Dyfed', 3 from dual)
    15  select  lpad(' ', 3 * (level - 1)) || t1.node as node,
    16          (select  min(t2.status)
    17           from    t t2
    18           connect by prior t2.id = t2.parent
    19           start   with t2.id = t1.id) as status
    20  from    t t1
    21  connect by prior t1.id = t1.parent
    22  start   with t1.parent is null;
    NODE               STATUS
    UK                      1
       Scotland             1
          Aberdeen          2
          Fife              2
          Edinburgh         1
       Wales                3
          Dyfed             3
    7 rows selected.Where the urgency of the status is indicated numerically, lowest = most urgent. You can use DECODE or CASE to translate character status codes into numbers and to translate numeric status codes into corresponding img filenames.

  • Is it possible to put the results from a query in a variable to use in the bean class?

    Hello, I'm using JDeveloper 12.1.2.0.0
    I would like to keep the result of my queries (the method i created in the AppModule) in a RichTable or other type of variable so i can have the results stored and i don't have to do unnecessary queries after. I don't think the query is the problem but keeping the results.
    I've tried to do that by using this:
        public String testVFactSales(String conditions) {
            PreparedStatement query = getDBTransaction().createPreparedStatement("" + "select * from v_fact_sales " + conditions, 0);
            //ResultSet rs;
            ResultSet result;
            //RichTable result;
            //String result = null;
            try {
                //query.setString(1, conditions);
                // query.execute();
                query.execute();
                result = query.getGeneratedKeys();
                query.close();
                System.out.println("Result: " + result.toString());
                return result.toString();
            } catch (SQLException e) {
                e.printStackTrace();
            return "";
    As you can see, i've already tried some solutions but so far i only get errors (cannot convert or null exception, when i try to put the result in a richtable in my bean class)
    Any ideas?
    This is very important for me, since it would improve the performance of my project a lot.
    Regards,
    Frederico.

    Hey Arunkumar,
    I came to this conclusion since i'm using binding variables with my where clauses.
    I've measured the time and i get really bad time responses.
    This is my main table query, where all the others selections will be filter the search in this table:
    SELECT VFactSalesNew.N_SALES,                              
           VFactSalesNew.QUANTITY,                              
           VFactSalesNew.PRICE,                               ,                              
           VFactSalesNew.FK_STORE,                              
           VFactSalesNew.ID_ANO,                              
           VFactSalesNew.QUARTER   
    FROM V_FACT_SALES_NEW VFactSalesNew                              
    WHERE                                          
    ((nvl(:var_dimCoin,'0') ='0' OR FK_COIN IN (select * from THE(select cast( in_list(:var_dimCoin) as mytableType ) from dual ) a) )                                                   
    AND                                                 
    (nvl(:var_dimProduct,'0') ='0' OR FK_PRODUCT IN (select * from THE(select cast( in_list(:var_dimProduct) as mytableType ) from dual ) a) )                                                  
    AND                                                 
    (nvl(:var_dimCustomer,'0') ='0' OR FK_CUSTOMER IN (select * from THE(select cast( in_list(:var_dimCustomer) as mytableType ) from dual ) a) )                                                 
    AND                                                 
    (nvl(:var_dimStore,'0') ='0' OR FK_STORE IN (select * from THE(select cast( in_list(:var_dimStore) as mytableType ) from dual ) a) )                                                
    AND                                                 
    (nvl(:var_dimSeller,'0') ='0' OR FK_SELLER IN (select * from THE(select cast( in_list(:var_dimSeller) as mytableType ) from dual ) a) )                                                  
    AND                                                 
    (nvl(:var_dimProject,'0') ='0' OR FK_PROJECT IN (select * from THE(select cast( in_list(:var_dimProject) as mytableType ) from dual ) a) )                                                  
    AND                                                 
    (nvl(:var_ano, '0') ='0' OR ID_ANO IN (select * from THE(select cast( in_list(:var_ano) as mytableType ) from dual ) a) )                                                  
    AND                                                 
    (nvl(:var_treemap,'0') ='0' OR PK_REGION IN (select * from THE(select cast( in_list(:var_treemap) as mytableType ) from dual ) a) )                                                  

Maybe you are looking for