Wrong query result

Hi,
I have an issue with the key figures (Net value total) defined in my query when there are multiple rows for a sales document/item. Here is the scenario which explains the problem.
Salesdoc Itemno net value sold to contact ID
3200 10 3000 ST0001 CT0001
3200 10 3000 ST0001 CT0002
3200 10 3000 ST0001 CT0003
Base on the above scenario, if I run the query and see the result for the Net value total of a sales document, it is showing up as $9000 (as there are 3 contact ID’s). The contacts are actually stored in a different ODS object. And this ODS object has been linked to the sales ODS object using an Infoset. And the query built on this infoset is causing this issue.
Please let me know if there is any workaround for this issue (The above scenario I mentioned is the result of the info set after combining data from Contact ODS and Sales ODS. And I don’t want to store the data in a separate ODS keeping the net value as $3000 for the first row and 0’s for the rest of the two rows, to resolve this issue).
Appreciate your help on this!
Thanks
MM.
Message was edited by: tony

i have a very simple example.
public class Simple {
private Integer id;
private String text;
public Integer getId() {
return id;
public void setId(Integer id) {
this.id = id;
public String getText() {
return text;
public void setText(String text) {
this.text = text;
and the query is
ReadObjectQuery query = new ReadObjectQuery();
query.setReferenceClass(Simple.class);
query.conformResultsInUnitOfWork();
Simple simple = new Simple();
simple.setText("c");
query.setExampleObject(simple);
the database tabel has 5 rows
1,a
2,b
3,c
4,a
5,a
before i execute the query i change the text
from the simple object ( from "c" to "x")
after execute
i get the object with id 5 and text "a"

Similar Messages

  • Wrong query results: due to date format?

    hello,
    I have oracle 11 and when I execute this query:
    select MYDATE from mytable order by MYDATE DESC;
    it get me a bad order:
    MYDATE
    25-MAR-09
    13-MAR-09
    10-MAR-10
    10-MAR-10
    31-JAN-10
    29-JAN-10
    28-JAN-10
    08-DEC-09
    07-DEC-09
    06-DEC-09
    05-DEC-09
    is it may due to a wrong date format?
    where have I to look out? init.ora?

    But, there is no problem at my end (Using Oracle 10.2.0.1 on win xp):
    SQL> create table t(mydate date);
    Table created.
    SQL> insert into t values(to_date('25-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('13-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('31-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('07-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('05-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('06-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('08-DEC-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('10-MAR-09','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('29-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('10-MAR-10','DD-MON-YY'));
    1 row created.
    SQL> insert into t values(to_date('28-JAN-10','DD-MON-YY'));
    1 row created.
    SQL> select * from t;
    MYDATE
    25-MAR-09
    13-MAR-09
    31-JAN-10
    07-DEC-09
    05-DEC-09
    06-DEC-09
    08-DEC-09
    10-MAR-09
    29-JAN-10
    10-MAR-10
    28-JAN-10
    11 rows selected.
    SQL> SELECT MYDATE FROM T ORDER BY MYDATE DESC;
    MYDATE
    10-MAR-10
    31-JAN-10
    29-JAN-10
    28-JAN-10
    08-DEC-09
    07-DEC-09
    06-DEC-09
    05-DEC-09
    25-MAR-09
    13-MAR-09
    10-MAR-09
    11 rows selected.
    SQL> SHOW PARAMETER NLS_DATE;
    NAME                                 TYPE        VALUE
    nls_date_format                      string
    nls_date_language                    stringCan you show us the output of
    show parameter nls_date;
    Regards
    Girish Sharma

  • WRONG QUERY RESULT WITH REPORTQUERIES AS SUBQUERIES

    hi,
    i create a ReadAllObject - Query with
    a ReportQuery as SubQuery.
    when execute the query the result at the SubQuery
    contains the data from the database.
    the result does not contain the change of these
    data in memory of the aplication.
    method public void conformResultsInUnitOfWork()
    has no effect
    i have a simple example
    public class A{
    private int id;
    private String name;
    private Collection B = new ArrayList();
    public class B{
    private int id;
    private String name;
    private C c ;
    public class C{
    private int id;
    private String name;
    and the query is
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(A.class);
    ReportQuery subQuery = new ReportQuery(A.class, subQueryEb);
    subQuery.addAttribute("id");
    subQuery.setSelectionCriteria(eb.anyOf("B").get("C").get("name").equal("Test")));
    query.querysetSelectionCriteria (eb.get("id").notExists(subQuery));

    Conforming subqueries and report queries are not supported in memory. You should be getting an exception thrown stating this.
    Your code does not show the call to conform, make sure it is on the root query, not the subquery.

  • Query result caching on oracle 9 and 10 vs indexing

    I am trying to improve performance on oracle 9i and 10g.
    We use some queries that take up to 30 minutes to execute.
    I heard that there are some products to cache query results.
    Would this have any advantage over using indexes or materialized views?
    Does anyone know any products that I can use to cache the results of this queries on disk?
    Personally I think that by using the query result caching I would reduce the cpu time needed to process the query.
    Is this true?

    Your message post pushes all the wrong buttons starting with the fact that 9i and 10g are marketing labels not version numbers.
    You don't tune queries by spending money and throwing resources at them. You tune them by identifying the problem queries, running explain plans, visualizing their output using DBMS_XPLAN, and addressing the root cause.
    If you want help post full version numbers, the SQL statements, and the DBMS_XPLAN outputs.

  • Query resulting Incorrect values

    Hello ALL.
    I need your suggestions on this issue.
    I have a Query on top of multiprovider which is on top of 6 cubes. In the query one RKF is resulting wrong values for Unassigned WBS Element Hierarchy.
    <u><b>RF: Forecast amount</b></u>
    0amount, Version:01, Vtype:20,Company Code:100,Fiscyear=2008 and Posting Period=1-12.
    Query resulting: 68,000 and Where as Multi prvider has only 2 rows satisfying the above Restrictions and giving 13,000.
    These wrong values are only for Unassgined Nodes of WBS Element.(Rows) Other node values are correct.
    I am not sure where it is getting these values?
    Kindly suggest.
    Thanks,
    Geetha
    <u></u>

    Can you chk if you have the values in the multiprovider?

  • Heirarchy is not appearing in my Query result

    Sub: Heirarchy is not appearing in my Query result
    Hi SAP Gurus!
    I am a BW learner..
    My environment is : Training client: SAP BW 3.1 along with SEM 3.2 and BI content 3.1
    What I did :
    1. I have created Info objects     :Mat_No,Mat_name, SRep_Id, SRep_name, Sales_Region, Sales_off, Cust_id, cust_name,
    2. I have created heirarchy for    : SRep_id with Sales_Region,Sales_office
    3. Maintained the master data for  : Sales Region and Sales Office
    4. Up loaded master data for       : Mat_master,Customer_master
    5. While designing the query       : SRep_Id has been dragged into 'Rows'and in the propertice of SRep_id select the name of heirarchy
    What is the problem              : Heirarchy is not appearing in my query result
    What I want is                     : Let ma know where went wrong and what to do for display
                                         of heirarchy in the query result.
    Can you help me in this regard?
    Thnaks in advance
    Vam C

    Thank You venkat and kamal..
    But I did the same and mentioned at point no 5. earlier..
    however I am not getting..
    Can you help me?
    Vam C

  • BI server generating wrong query

    Hi,
    I have an issues with query generation by report. we have one fact table and 3 dim tables using by query. If I use aggregate functions like max, avg and stddev in column formula, BI server generating wrong query but normal report without any aggregate functions working fine(generation correct query by bi server). fact tables sources>>content tab, level settng to all three dim tables is at detailed level. I'm expecting BI server to rollup the detailed data to calculate min, max and stddev but it's not doing that and it is trying to join so many other unwanted tables in the query and fetching no result.
    How would I fix the above problem? thanks for your help
    Thanks
    Jay.

    One of the dimension table have joins to other fact tables and query routed through unwanted dim and fact tables. this is happeneing because of aggregate navigation in fact sources, content tab set to detailed level. I'm trying to use aggregate functions...

  • Normalization of query result

    Hi BW Geeks.....
    I created a report and my requirement was to get the ratio of  Employee1 salary to the Total salary. So in the properties of the Salary Key Fig I choose Calculate single value as Normalise to Query Result. It gave me percentage(ratio) of each salary to the total salary. But when I multiply Normalised keyfigure with a restricted kf ,..the ratio doesnt get muliplied instead the actual value gets multiplied.
    eg:----
    Salary   Normalised to Query result     
    $5000      5000/8000 = 62.5% 
    $3000      3000/8000 =37.5%
    Total---$8000 
    Now when I multiply this Normalised Query result with another restricted kf who has value say $1000 I get (5000) X  (1000)-= 5000000  which is wrong. I want to get (62.5%)X (1000)= $625.00.
    Can ne body please tell me y its doing tht way....Please help me its urgent
    I will assign full points
    Nikhil

    Hi Nikhil,
    The display option does not change the underlying value of the key figure, so when you are multiplying the mormalized value it will still use the underlying value in the calculation.
    The other option to do this would be:
    Create a new calculated key figure "salary" with a percentage function which is Percentage share of overall result. This key figure will display the data in %.
    You can then use this calculated key figure in your subsequent calculated key figures.
    Let me know if this helps.
    Cheers
    Amol

  • What does "*" mean in my query result?

    Hello all,
    I met a problem in my query result which was some of cells in one KF column didn't display the amount but instead with * . Could anybody tell me what the wrong was?
    thanks
    Ryan

    Hi Ryan,
    This normally happens when the key figures refers to a unit / currency and the units and currencies are different for different records in the result set of the query.
    BEx couldn't sum amounts with different currency or value with different unit. hence you get a '*'. However if you put your cursor on the cell then you can actually see total amount in the cell value at the top header of the excel.
    Hope it helps.
    Thanks
    Soumya

  • Wrong query output..

    Guys,
    Please can someone help me ? I am getting a wrong query output.. There is data available for 31-DEC-2006 but the below query doesn't seem to display it.. What could be the reason ? The query displays results for all date except 31st
    SELECT   date_inserted                 ||','||
          COUNT (DECODE (HR, '00', user_id)
                   )                      ||','||
             COUNT (DECODE (HR, '01', user_id)
                   )                     ||','||
             COUNT (DECODE (HR, '02', user_id)
                   )                     ||','||
             COUNT (DECODE (HR, '03', user_id)
                   )                     ||','||
             COUNT (DECODE (HR, '04', user_id)
                   )                     ||','|| 
             COUNT (DECODE (HR, '05', user_id)
                   )                     ||','||  
             COUNT (DECODE (HR, '06', user_id)
                   )                     ||','|| 
             COUNT (DECODE (HR, '07', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '08', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '09', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '10', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '11', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '12', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '13', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '14', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '15', user_id)
                )                     ||','||
             COUNT (DECODE (HR, '16', user_id)
                   )                     ||','||
          COUNT (DECODE (HR, '17', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '18', user_id)
                   )                     ||','|| 
          COUNT (DECODE (HR, '19', user_id)
                   )                     ||','||
          COUNT (DECODE (HR, '20', user_id)
                   )                     ||','||   
          COUNT (DECODE (HR, '21', user_id)
                   )                     ||','||
          COUNT (DECODE (HR, '22', user_id)
                   )                     ||','||   
          COUNT (DECODE (HR, '23', user_id)
                   )                     ||','
        FROM (
    select      distinct user_id,
         trunc(date_inserted) date_inserted,
         to_char(date_inserted,'HH24') HR
    from      production.gl_user_game_sessions ugs
    where      date_inserted between '01-DEC-2006' and '31-DEC-2006'
    AND exists(     select 1
              from production.gl_user_registrations gur
               where gur.registration_site = 'rokes.com'
              and  gur.user_id = ugs.user_id)
    order by user_id,trunc(date_inserted))
    group by date_inserted
    order by date_inserted
    Date,00:00 to 00:59,01:00 to 01:59,02:00 to 02:59,03:00 to 03:59,04:00 to 04:59,05:00 to 05:59,06:00
    01-DEC-06,66,47,23,20,11,9,23,45,59,82,68,78,77,87,85,101,118,129,129,140,139,142,132,111,
    02-DEC-06,88,53,29,24,15,19,15,38,53,66,83,96,85,116,128,139,133,132,123,102,133,125,113,113,
    03-DEC-06,100,68,45,23,18,14,21,19,42,75,87,87,82,92,103,72,0,111,225,170,165,125,124,81,
    04-DEC-06,70,42,25,36,8,15,22,35,58,68,54,75,78,78,101,90,125,130,132,112,107,132,122,81,
    05-DEC-06,56,44,25,12,6,16,28,28,69,89,65,75,67,86,110,90,104,123,123,144,137,140,109,83,
    06-DEC-06,54,36,24,11,12,13,21,28,60,72,61,89,67,73,105,94,104,106,131,127,170,123,134,85,
    07-DEC-06,58,26,23,17,11,9,22,31,59,63,69,75,82,79,103,79,102,106,150,138,178,163,126,103,
    08-DEC-06,59,45,19,17,12,10,24,35,59,57,75,64,68,59,92,101,108,123,131,119,133,129,110,80,
    09-DEC-06,77,50,28,21,14,16,19,32,65,61,69,87,107,109,106,114,121,122,94,113,113,110,131,101,
    10-DEC-06,73,57,42,16,21,18,20,25,34,61,44,88,62,88,96,127,140,107,141,115,117,126,93,78,
    11-DEC-06,58,32,17,8,6,8,14,29,57,62,76,73,58,72,96,95,102,98,129,126,124,148,117,92,
    12-DEC-06,67,37,20,15,11,16,19,33,62,76,75,55,67,71,75,98,103,101,116,119,134,121,120,88,
    13-DEC-06,57,37,11,15,3,14,2,0,9,73,61,59,59,75,85,87,97,107,122,124,143,129,124,105,
    14-DEC-06,55,39,14,16,11,17,25,35,40,61,54,62,69,68,87,79,108,99,118,132,132,142,124,82,
    15-DEC-06,69,39,21,26,12,13,17,27,50,64,69,60,74,88,88,92,115,105,114,127,106,123,117,114,
    16-DEC-06,77,59,27,24,20,16,17,24,41,68,75,98,82,87,90,111,103,122,102,99,131,71,117,103,
    17-DEC-06,84,47,22,17,13,13,12,25,40,59,45,56,72,82,85,96,88,106,107,117,149,116,105,82,
    18-DEC-06,51,24,29,12,15,10,10,28,38,38,48,47,59,80,72,74,91,103,100,116,119,123,139,83,
    19-DEC-06,53,36,17,12,11,23,20,29,58,77,70,71,62,83,81,89,106,104,101,120,130,118,125,94,
    20-DEC-06,60,32,12,18,11,14,17,27,53,56,66,67,76,65,103,103,125,92,112,123,109,130,108,86,
    21-DEC-06,50,29,22,16,9,12,22,34,35,58,78,71,62,85,101,105,110,124,129,147,156,129,108,88,
    22-DEC-06,64,36,23,28,20,14,31,44,58,49,65,78,76,81,109,117,139,138,141,121,112,130,128,94,
    23-DEC-06,95,67,31,28,22,13,21,32,40,48,80,76,83,105,123,126,118,155,131,124,147,124,135,106,
    24-DEC-06,84,53,44,31,15,18,22,33,36,58,76,82,91,90,113,124,118,113,98,108,117,124,107,91,
    25-DEC-06,71,54,40,15,12,20,17,22,38,61,56,70,63,73,94,93,109,97,87,100,98,109,85,84,
    26-DEC-06,56,45,18,23,13,14,14,18,35,48,73,82,95,115,143,153,136,147,111,110,138,125,96,85,
    27-DEC-06,82,42,27,18,13,13,27,18,37,60,65,87,78,94,164,166,171,147,160,143,120,150,118,115,
    28-DEC-06,98,51,38,28,18,22,16,25,49,57,78,82,95,129,145,135,145,142,133,157,183,165,131,136,
    29-DEC-06,93,62,32,20,16,13,24,31,51,72,71,84,96,110,179,166,190,167,156,153,142,162,148,114,
    30-DEC-06,94,66,44,28,18,18,21,21,41,53,95,87,91,139,161,154,201,162,150,166,152,128,144,133,
    SQL> Thanks in advance
    G

    Hi,
    try this:
    where date_inserted between to_date('01-DEC-2006 00:00:00','DD-MM-YYYY HH24:MI:SS') and to_date('31-DEC-2006 23:59:59' 'DD-MM-YYYY HH24:MI:SS')(not tested)

  • Problem viewing Query Result

    Hi- I occasionally come across this issue when I run any query in SQL Developer (3.0.02), the Query Result tab shows a bold red Exclamation point and the display grid is blank. It says "Fetched 50 rows in 0.235 seconds" but the results aren't displayed. There is nothing wrong with the queries so it seems like some type of display problem but I can't figure out how to fix it. Like I said, it doesn't happen all the time and I run the same saved queries so I know it's not a problem with the actual queries. Has anyone ever seen or heard of this before?

    Hi,
    Sounds like you are using an early adopter version of 3.0. Why not upgrade to the latest production release (3.1.07.42)?
    A similar situation is described in this old thread:
    Re: Randomly not getting query results
    Regards,
    SQL Developer Team

  • Service Offering, Query Results question.

    Hi,
    I got a question about the Service Offering, Query Results criteria page.
    As shown in the Picture below i have a Query based on the Active Directory User Class.
    The background is that i got alot of accounts more than 2000. The token "String" is used to narrow down the search. I also got some accounts that i dont want to show in the portal for the end users (The ones who
    ends with "Z" in the pager).
    Generally i would say that the "OR" would be "AND" (due to it is an logical operator, i want both conditions to be true) between the two UserPager properties, but i havent found any way to change that. I suspect that it is not possible
    to change "OR" to "AND" when making criterias against the same values more than 1 time.
    The Query below will return all accounts under that Distinguished name, even if i wrote something in the String prompt.  Removing the Criteria Pager ends on "Z" makes the String prompt work. But it will not exclude those objects ending with
    Z. Is this a normal behavior or am i thinking/doing sometime wrong?

    This is how all criterias work in service manager. If the same property is included more than once it puts an OR inbetween. You would have to export the MP that contains the query result and edit the criteria manually to AND.
    Cheers,
    Anders Spælling
    Senior Consultant
    Blog:  
    Twitter:   LinkedIn:
    Please remember to 'Propose as answer' if you find a reply helpful

  • Query results to a file

    I have a requirement to put the query result in a file(.csv),
    Pls let me know is there a possibility to achieve this using dbms_output package
    Thanks

    859486 wrote:
    I have a requirement to put the query result in a file(.csv),
    Pls let me know is there a possibility to achieve this using dbms_output packageNo. The DBMS_OUTPUT package is almost ALWAYS the wrong package to use. It is the most misunderstood and most frequently abused piece of PL/SQL software. So no - it is not suited in anyway to spool CSV output. In fact, trying it with a large SQLdataset can crash the Oracle server - as memory will be exhausted and the swap daemons will trash CPU utilisation.
    To read or write a physical o/s file - the typical package used is UTL_FILE. It is fairly easy using UTL_FILE to create a CSV file.
    However, there could be far better alternatives. The CSV file may be needed by a web client - in which case the file can be created as a CLOB and provided as a Mime text/csv data stream to a web browser (which usually will automatically open in Excel).
    The CSV file may need to be delivered via e-mail. In which case, the CSV file contents can be delivered via UTL_SMTP to a mail server as an e-mail attachment.
    The CSV file may be needed to be delivered to a remote server. In which case the CSV file can be created as a CLOB and this CLOB can be ftp'ed via PL/SQL to the remote server as a text file.
    So there are many options in creating and delivering a CSV file. Using DBMS_OUTPUT though is not a sensible option - ever.

  • Updating field in query result pls give me response asap

    Hi,
    i have a custom button in my page and when i press that button one more field going to modified(it is displaying some date)
    problem is when i tried to modified from back end modified that query result (that action query date) from fret-end it is not modifying
    i think i need to create dynamic vo or what?
    if i am wrong
    pls help me how can i solve this?
    thanks&regarding
    srinivas

    I'm afraid what you've written is not clear. Without attempting to be rude your English is poor.
    I suggest restating the problem.
    CM.

  • Getting query results from a PL/SQL procedure

    Hi! So, I’m a little stumped and I can’t seem to find the answer to what I believe is probably a simple question…
    So, here goes… I have a big ol’ union query that I use to create a report on a page, it’s about 25k – not over the 32k limit, but fails to be able to compile every time (I always get a 400 – Bad Request error). I’m not sure why this is happening, but I can remove a union statement and it compiles just fine – so it has something to do with the size of the query. ANYWAY – I’ve resolved that I should put this bad boy into the database as a stored procedure and just call it from Apex, my problem is I can’t figure out quite how to do this with variables, etc.…
    Instead of giving you my whole big query, I’ll use the emp table as the concept is the same:
    Say we have a query that creates a report on a page:
    select empno, ename, job, mgr, hiredate, sal, comm, deptno
    from emp
    where job = :P_JOB
    and hiredate >= :P_HIREDATE;
    How would I take this query, create it as a stored procedure on the db, pass the variables from Apex and return the query result set from the stored proc as a report?
    I really appreciate any help on this!
    Best,
    Gilcrest

    Hi Gilcrest,
    You should create the query as a View and use the view name and the WHERE clause in the report's sql source.
    Andy

Maybe you are looking for

  • Limiting records in a named query

    Hello, I can retrieve all the records using the following named query: <named-query name="emploee.findemployees"> <query>select e from employee e </query> </named-query> Can somebody help me how i can retrieve only the first 5 records using the named

  • Starting up the database

    Hi, I hav installed oracle database 10g in oel5.I want to know how to start the database? pls help me,

  • OCS 2007 R2 and Exchange 2013

    Cannot find any information about this. I cannot find anything on OCS2007 R2 with Exchange 2013. We have OCS 2007 R2 with Exchange 2007. The plan is to migrate Exchange 2007 to Exchange 2013. We configured new Exchange server and migrated test user.

  • Is Bonus buy,promotion or sales deal available in IS AFS?

    Hello gurus, Can any one tell me whether the Bonus Buy, promotions or sales Deals available in IS AFS 6.0 Thanks and Regards Kishore

  • BI academy India

    Hello all I was interested in doing the BI academy from India, but since the last year and a-half there are no academies planned for BI or BW. The siemens calender in India has got no mention of such a course , also for 2008. Neither does Genovate ha