SQL subquery returning too many rows with Max function

Hello, I hope someone can help me, I been working on this all day. I need to get max value, and the date and id where that max value is associated with between specific date ranges. Here is my code , and I have tried many different version but it still returning
more than one ID and date
Thanks in advance
SELECT
  distinctbw_s.id, 
avs.carProd,cd_s.RecordDate,
cd_s.milkProductionasMilkProd,
cd_s.WaterProductionasWaterProd
FROMtblTestbw_s
INNERJOINtblTestCpcd_sWITH(NOLOCK)
ONbw_s.id=cd_s.id   
ANDcd_s.recorddateBETWEEN'08/06/2014'AND'10/05/2014'
InnerJoin
(selectid,max(CarVol)ascarProd
fromtblTestCp
whererecorddateBETWEEN'08/06/2014'AND'10/05/2014'
 groupby 
id)avs
onavs.id=bw_s.id
id RecordDate carProd       MilkProd WaterProd
47790 2014-10-05   132155   0 225
47790 2014-10-01   13444    0 0
47790 2014-08-06   132111    10 100
47790 2014-09-05   10000    500 145
47790 2014-09-20   10000    800 500
47791 2014-09-20   10000    300 500
47791 2014-09-21   10001    400 500
47791 2014-08-21   20001    600 500
And the result should be ( max carprod)
id RecordDate carProd       MilkProd WaterProd
47790 2014-10-05   132155  0 225
47791 2014-08-21   20001    600 500

Help your readers help you.  Remember that we cannot see your screen, do not know your data, do not understand your schema, and cannot test a query without a complete script.  So - remove the derived table (to which you gave the alias "avs")
and the associated columns from your query.  Does that generate the correct results?  I have my doubts since you say "too many" and the derived table will generate a single row per ID.  That suggests that your join between the first
2 tables is the source of the problem.  In addition, the use of DISTINCT is generally a sign that the query logic is incorrect, that there is a schema issue, or that there is a misunderstanding of the schema. 

Similar Messages

  • Resultset returning too many rows when using Group by

    Hello
    My problem is this
    I run the following query which uses a Group By
    sQury = "SELECT Distinct Searches.categoryId ,count(Searches.categoryId) AS NUMBER_OF_APPEARANCE" +
    " FROM Searches " +
    " GROUP BY Searches.categoryId ";
    When I run this query in Access the query returns 15 rows (since I have 15 products)
    When I run this query by opening Resultset I get 60 rows (Which are the number of records in Searches table)
    NOTE: the first 15 rows in the resultset are the 15 rows I got in access and after that I have something like null rows with no data inside (with causes real problems to my program
    I use the followin code in order to run the query
    public ResultSet m_resultSet = null;
    private Statement m_stat;
    private Connection m_conn;
    m_stat = m_conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    m_stat.execute(sql)
    m_resultSet = dbResultSet.m_stat.getResultSet();
    If any one see any problem with this please help

    Try removing distinct as well.
    (The above suggestion also makes sense as it is not possible to update a count. Even if it has no impact on the problem.)

  • Tag Query History mode returning too many rows of data

    I am running a Tag Query from HQ to a plant site and want to limit the amount of data that returns to the minimum required to display trends on a chart.  The minimum required is subjective, but will be somewhere between 22 and 169 data points for a weeks data.  Testing and viewing the result is needed to determine what is an acceptable minimum. 
    I build a Tag Query with a single tag and set it to History Mode.  I set a seven day period going midnight to midnight.  And I set the row count to 22.  When I execute the query it returns 22 data points.  But when I go to visualization, I get 565 datapoints.  So obviously that is not what I want as I want a very slim dataset coming back from the IP21 server (to minimize the load on the pipe). 
    Any suggestions?

    Hi Michael,
    it looks to me like you have enabled the "Use Screen Resolution" option in your display template or in the applet HTML. Setting this option makes the display template fetch as many rows as there are pixels in the chart area. Like setting a rowcount in the applet HTML as a param, this will override any rowcount limitations you have set at the Query Template level...
    Hope this helps,
    Sascha

  • Pl/Sql block returning too many values

    Hi
    Below is simple pl/sql block.while excecuting this i'm getting too many values exception
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC) where rownum = 1;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;
    could anybody please help me how to rewrite this qwery to get only one record.
    we are not supposed to use cursors here,
    thanks

    I am just changing your logic,
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC where rownum = 1) ;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;

  • Left join and where clause with not equal ( ) returns too many rows

    Say I have something like this
    Table A
    =========
    Id
    OrderNum
    Date
    StoreName
    AddressKey
    Table B
    ========
    Id
    StreetNumber
    City
    State
    select a.* from [Table A] a
    left join [Table B] b on a.AddressKey = b.Id
    where a.StoreName <> 'Burger place'
    The trouble is that the above query still returns rows that have StoreName = 'Burger place'
    One way Ive handled this is to use a table expression, select everything into that, then select from the CTE and apply the filter there.  How could you handle it in the same query however?

    Hi Joe,
    Thanks for your notes.
    INT SURROGATE PRIMARY KEY provides a small footprint JOIN ON column. Hence performance gain and simple JOIN programming.  In the Addresses table, address_id is 4 bytes as opposed to 15 bytes san. Similarly for the Orders table.
    INT SURROGATE PRIMARY KEY is a meaningless number which can be duplicated at will in other tables as FOREIGN KEY.  Having a meaningful PRIMARY KEY violates the RDBMS basics about avoiding data duplication.  If I make CelebrityName (Frank Sinatra)
    a PRIMARY KEY, I have to duplicate "Frank Sinatra" as an FK wherever it needed as opposed to duplicating SURROGATE PRIMARY KEY CelebrityID (79) a meaningless number.
    This is how we design in SQL Server world.
    QUOTE from Wiki: "
    Advantages[edit]
    Immutability[edit]
    Surrogate keys do not change while the row exists. This has the following advantages:
    Applications cannot lose their reference to a row in the database (since the identifier never changes).
    The primary or natural key data can always be modified, even with databases that do not support cascading updates across related
    foreign keys.
    Requirement changes[edit]
    Attributes that uniquely identify an entity might change, which might invalidate the suitability of natural keys. Consider the following example:
    An employee's network user name is chosen as a natural key. Upon merging with another company, new employees must be inserted. Some of the new network user names create conflicts because their user names were generated independently (when the companies
    were separate).
    In these cases, generally a new attribute must be added to the natural key (for example, an
    original_company column). With a surrogate key, only the table that defines the surrogate key must be changed. With natural keys, all tables (and possibly other, related software) that use the natural key will have to change.
    Some problem domains do not clearly identify a suitable natural key. Surrogate key avoids choosing a natural key that might be incorrect.
    Performance[edit]
    Surrogate keys tend to be a compact data type, such as a four-byte integer. This allows the database to query the single key column faster than it could multiple columns. Furthermore a non-redundant distribution of keys causes the resulting
    b-tree index to be completely balanced. Surrogate keys are also less expensive to join (fewer columns to compare) than
    compound keys.
    Compatibility[edit]
    While using several database application development systems, drivers, and
    object-relational mapping systems, such as
    Ruby on Rails or
    Hibernate, it is much easier to use an integer or GUID surrogate keys for every table instead of natural keys in order to support database-system-agnostic operations and object-to-row mapping.
    Uniformity[edit]
    When every table has a uniform surrogate key, some tasks can be easily automated by writing the code in a table-independent way.
    Validation[edit]
    It is possible to design key-values that follow a well-known pattern or structure which can be automatically verified. For instance, the keys that are intended to be used in some column of some table might be designed to "look differently from"
    those that are intended to be used in another column or table, thereby simplifying the detection of application errors in which the keys have been misplaced. However, this characteristic of the surrogate keys should never be used to drive any of the logic
    of the applications themselves, as this would violate the principles of
    Database normalization"
    LINK: http://en.wikipedia.org/wiki/Surrogate_key
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Left outer join using date range returns too many rows

    I am trying to pull data for a website.
    Names table:
    company_name varchar2(30)
    julian_day varchar2(3)
    logins number(3)
    login_errors number(3)
    Given a julian date range (e.g. 250-252), I am displaying the information from the Names table.
    The problem is that I also need to display changes (increases/decreases) in the data. I do that by coloring the text based on a 10% increase/decrease. Data for the 3 days 250-252 would be compared to data for the previous 3 days 247-249.
    Not all companies will report data on all days, so some gaps in the data may exist. Therefore, I cannot do just a simple join.
    I am trying to write a query that will give me this information if the user chooses days 250-252.
    Company_name
    sum(logins) for days 250-252
    sum(login_errors) for days 250-252
    sum(logins) for days 247-249
    sum(login_errors) for days 247-249
    The query I'm using is:
    select cur.company_name, sum(cur.logins),
    sum(cur.login_errors), sum(old.logins), sum(old.login_errors)
    FROM names cur LEFT OUTER JOIN names old
    ON cur.company_name = old.company_name
    WHERE cur.adate>='250' and cur.adate<='252'
    and old.adate>='247' and old.adate<='249'
    GROUP by cur.company_name
    Given this data:
    Company_name adate logins login_errors
    ABC 247 10 10
    ABC 248 20 20
    ABC 249 30 30
    ABC 250 15 15
    ABC 251 25 25
    ABC 252 35 35
    My problem is that it returns:
    adate cur.logins cur.login_err old.logins old.login_err
    250 15 15 60 60
    251 25 25 60 60
    252 35 35 60 60
    How can I get it to only give me the one "old" day's data? I went with the LEFT OUTER JOIN because it's possible that there is no data for an "old" day.
    Thanks in advance.....

    Your problem stems from the join itself, and would be the same even without the OUTER JOIN. With your data, there are 3 records in cur and 3 records in old. The join matches each record in cur to each record in old resulting in 9 records in total. Without the SUM, this is clear:
    SQL> SELECT cur.company_name, cur.logins, cur.login_errors,
      2         old.logins, old.login_errors, cur.adate cad, old.adate oad
      3  FROM names cur LEFT OUTER JOIN names old
      4                 ON cur.company_name = old.company_name
      5  WHERE cur.adate>=250 and cur.adate<=252 and
      6        old.adate>=247 and old.adate<=249;
    COMPANY_NA     LOGINS LOGIN_ERRORS     LOGINS LOGIN_ERRORS        CAD        OAD
    ABC                35           35         10           10        252        247
    ABC                25           25         10           10        251        247
    ABC                15           15         10           10        250        247
    ABC                35           35         20           20        252        248
    ABC                25           25         20           20        251        248
    ABC                15           15         20           20        250        248
    ABC                35           35         30           30        252        249
    ABC                25           25         30           30        251        249
    ABC                15           15         30           30        250        249
    9 rows selected.You can do this with only one reference to the table.
    SELECT company_name,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN logins ELSE 0 END) curlog,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN login_errors ELSE 0 END) curerr,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN logins ELSE 0 END) oldlog,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN login_errors ELSE 0 END) olderr
    FROM names
    WHERE adate BETWEEN 247 and 252
    GROUP BY company_nameHTH
    John

  • SQL Expression returning too many results

    I am trying to display the value of a field in one table as a caption in the report header. This  caption is above a u2018descriptionu2019 field in the details section. When I run my report, I get  the description field displaying 832 times; which is the number of rows found in my caption table. Here is the structure of the two tables:
    Table 1: Code, Description
    Table 2: Table, Name, Field Name, Caption
    Here are the SQL Expressions that I have tried:
    (SELECT Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    (SELECT DISTINCT Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    And
    (SELECT TOP 1 Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    If I run these directly in my Db, I get correct results. If in Crystal, incorrect results. I have tried the following suppress on the Details: Table1.Code= previous (Table1.Code) which works UNLESS I have any summaries. Once I include a summary, my total ALWAYS factors in the suppressed, duplicate records.
    I have now moved to try using parameters and a sub report for each caption; however my existing reports have sub reports that also need caption changes and I am not aware of a way to add a subreport to a subreport
    Any ideas?

    can you use select distinct on all the queries,
    crystal tends to duplicate
    create a group for your distinct value
    place the records in the group header and it will return the first unique value it hits.

  • Issue with Oracle Merge statements (PL/SQL: ORA-00913: too many values)

    Hi All,
    I am using the below merge statement and I am getting too many rows issues when I am compiling.
    BEGIN
    FOR te_rec IN ( SELECT /*+ parallel(ts,4) */ te.dtv_acct_num FROM telcos_eligible te, telcos_setup ts, telcos_partners tp
    WHERE tp.telcos_name = UPPER((p_telcos_name))
    AND ts.partner_id = tp.partner_id
    AND te.ts_id = ts.ts_id ) LOOP
    MERGE INTO tcs_accounts
    USING (
    SELECT /*+ DRIVING_SITE(a) */account_id, a.subscriber_id, status, account_type FROM account@tcs_to_paris a WHERE a.subscriber_id = te_rec.dtv_acct_num
    ) paris_accounts
    ON (tcs_accounts.subscriber_id = paris_accounts.subscriber_id)
    WHEN MATCHED THEN
    UPDATE SET
    account_type = paris_accounts.account_type,
    subscriber_id = paris_acounts.subscriber_id,
    status = paris_accounts.status
    WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);
    END LOOP;
    END;
    Can you let me know what is the issue here.
    Thanks,
    MK.

    Hi,
    Maddy wrote:
    ... WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);This is one of the many times when a little formatting can really help you. Anybody can forget a column (or have an extra one, or type a _ when they mean ,) but if you write code like this
    INSERT (               account_id,                 subscriber_id,                                  status_account_type)
    VALUES (paris_accounts.account_id,  paris_accounts.subscriber_id,  paris_accounts.status,  paris_accounts.account_type);you might spot the error yourself.
    Always format your code. When you post any formatted text on thsi site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 11g-[nQSError: 42029] Subquery contains too many values for the IN predicat

    Hi,
    I am having 2 reports one is for subquery which returns inputs to Main report. Actually the report was working fine in 10g. But in 11g we are gettting following error:
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 42029] Subquery contains too many values for the IN predicate.Please have your System Administrator look at the log for more details on this error. (HY000)
    Please have your System Administrator look at the log for more details on this error.
    Getting same error after modofying the parameter value MAX_EXPANDED_SUBQUERY_PREDICATES to 12000
    Please suggest what could be the other reason it may fail or any other settings we need to check.
    Regards,
    ckeng

    ckeng,
    Normally the IN clause has restriction of 10000 values in general sql/plsql we will go with inline queries i think model your rpd to generate inner queries
    select * from emp where dept_id in (Select distinct dept_id from dept);
    or have a condition/filter on sub report and make one more inner report with sub-filter but definitely it will cause performance issues.
    thanks,
    Saichand.v

  • Exception too many rows...

    Hi
    I am getting two different outputs with following code depending upon i declare the variable in first or second way...
    when i declare the variable v_empno as number(10) and too many rows exception is raised....and after that i dbms this variable..it is null...
    but when i declare the same variable as table.column%type....and the similar scenario happens and i dbms the value of variable...it is not null...rather the first value from output of the query...
    declare
    --v_empno number(10);
    v_empno emp.empno%type;
    begin
    dbms_output.put_line('before '||v_empno );
    select empno into v_empno from emp;
    dbms_output.put_line('first '||v_empno);
    exception when too_many_rows then
    dbms_output.put_line('second '||v_empno);
    dbms_output.put_line('exception'||sqlerrm);
    end;
    is there any specific reason for this....
    ur comments plz
    Thanks
    Sidhu

    In 9i:
    SQL> declare
      2  --v_empno number(10);
      3  v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11  end;
    12  /
    before
    second 7369
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.
    SQL> declare
      2  v_empno number;
      3  --v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11  end;
    12  /
    before
    second
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.
    SQL> edit
    Wrote file afiedt.buf
      1  declare
      2  v_empno number(10);
      3  --v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11* end;
    SQL> /
    before
    second 7369
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.In 10G:
    SQL> declare
      2  v_empno number(10);
      3  --v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11  end;
    12  /
    before
    second 7369
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.
    SQL> edit
    Wrote file afiedt.buf
      1  declare
      2  v_empno number;
      3  --v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11* end;
    SQL> /
    before
    second 7369
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.
    SQL> edit
    Wrote file afiedt.buf
      1  declare
      2  --v_empno number;
      3  v_empno emp.empno%type;
      4  begin
      5  dbms_output.put_line('before '||v_empno );
      6  select empno into v_empno from emp;
      7  dbms_output.put_line('first '||v_empno);
      8  exception when too_many_rows then
      9  dbms_output.put_line('second '||v_empno);
    10  dbms_output.put_line('exception'||sqlerrm);
    11* end;
    SQL> /
    before
    second 7369
    exceptionORA-01422: exact fetch returns more than requested number of rows
    PL/SQL procedure successfully completed.Anyhow you should not rely on the fact Oracle fetches the first value into variable
    and keeps it when the excaprion is raised.
    Tom Kyte discusses the SELECT INTO issue here:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:7849913143702726938::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:1205168148688
    Rgds.

  • Too many rows found

    I have two data blocks, one data block joins two tables and second datablock is based on one table.
    first datablock has all fields with 1:1 relationship with Packing_id and second data block details has multiple rows
    for every Packing_id. I wrote 2 procs for 2 datablocks are called in respective Post-Query trigger.
    My problem is when I am running forms it gives error Message('too many rows found_orders_begin');
    Here are my codes.
    PROCEDURE post_query IS
    CURSOR mast_cur IS
    SELECT pa.ship_to_last_name,
    pa.ship_to_first_name,
    pa.ship_to_address1,
    pa.ship_to_address2,
    pa.ship_to_city,
    p.packing_id,
    FROM packing_attributes pa,packing p
    WHERE p.packing_id ; = pa.packing_id
    AND p.packing_id ; = :PACKING_JOINED.PACKING_ID;
    BEGIN
    Message('too many rows found_orders_begin');
    OPEN mast_cur;
    loop
    FETCH mast_cur INTO :PACKING_JOINED.SHIP_TO_LAST_NAME,
    :PACKING_JOINED.SHIP_TO_FIRST_NAME,
    :PACKING_JOINED.SHIP_TO_ADDRESS1,
    :PACKING_JOINED.SHIP_TO_ADDRESS2,
    :PACKING_JOINED.SHIP_TO_CITY,
    :PACKING_JOINED.PACKING_ID,
    end loop;
    CLOSE mast_cur;
    EXCEPTION
    WHEN too_many_rows THEN
    Message('too many rows found');
    WHEN no_data_found THEN
    Message('no data was found there');
    WHEN OTHERS THEN
    Message('do something else');
    END post_query;
    Detail proc
    PROCEDURE post_query IS
    CURSOR det_cur IS
    SELECT pd.quantity,
    pd.stock_number,
    FROM packing_details pd,packing p
    WHERE p.packing_id ; = pd.packing_id
    AND pd.packing_id = :PACKING_JOINED.PACKING_ID;
    BEGIN
    Message('too many rows found_pack_begin');
    OPEN det_cur;
    FETCH det_cur INTO
    :DETAILS.QUANTITY,
    :DETAILS.STOCK_NUMBER,
    CLOSE det_cur;
    EXCEPTION
    WHEN too_many_rows THEN
    Message('too many rows found');
    WHEN no_data_found THEN
    Message('no data was found there');
    WHEN OTHERS THEN
    Message('do something else');
    END post_query;
    Thanks in advance for your help.
    Sandy

    Thanks for reply.
    Maybe it gives this message because you have programmed to show this message ?
    I intentionally gave this message to see how far my code is working,if I don't give this message and execute query I get FRM-41050:You cannot update this record.
    Even though I am not updating record(I am querying record) and data block UPdate Allowed is set to NO.
    Some additional comments on your code:
    What is the loop supposed to do? You just fill the same fields in forms repeating with the values of your cursor, so after the loop the last record from your query will be shown. In general, in POST-QUERY you read Lookup's, not details.
    Sorry but I have no idea how to show detail records,thats why i tried with loop. In first proc I will have only 1 row returned so I guess I don't need loop in that proc?
    In second there will be multiple rows for one packing_id(packing_id is common column for both block), please let me know how to do that?
    Your exception-handler for NO_DATA_FOUND and TOO_MANY_ROWS are useless, for these errors cannot be raised using a cursor-for-loop
    I will remove these. Thanks
    Sandy
    Edited by: sandy162 on Apr 2, 2009 1:28 PM

  • Too many tables with EXECUTE permision

    Hi Gurus,
    I found that my live databases has too many tables with EXECUTE permision. But I dont know how it happens: my query as follows:
    select table_name
    from dba_tab_privs
    where owner='SYS' AND
    privilege = 'EXECUTE' AND
    grantee = 'PUBLIC'
    result
    TABLE_NAME
    /598cc2d9_AWExceptionMessageRe
    /24bd47b0_AWExceptionMessageRe
    /b99e8561_AWExceptionMessageRe
    /968869b8_AWExceptionMessageRe
    /f8bf68b3_AWExceptionMessageRe
    /9abd5a42_AWExceptionMessageRe
    /5e83964b_AWExceptionMessageRe
    /f01cb9e5_AWExceptionMessageRe
    /380f765f_AWExpressCommandExce
    /adef78c4_AWMemberExistsExcept
    /5166f5c2_AWObjectExistsExcept
    TABLE_NAME
    oracle/AWXML/SparseDefinition
    oracle/AWXML/ModelDimRef
    /9d17934e_AWFunctionNotSupport
    /d18d9de8_AWHandlerBaseTest
    DBMS_AW_XML
    INTERACTIONEXECUTE
    CWM2_OLAP_INSTALLER
    DBMS_XSOQ_ODBO
    OLAPI_MDX_ROWSET_IMPL_T
    OLAPI_MDX_ROWSET_TABLE
    16444 rows selected.
    ==========================================================
    Then I execute above query in other database. result was:
    TABLE_NAME
    STANDARD
    UTL_HTTP
    DBMS_PICKLER
    DBMS_JAVA_TEST
    UTL_FILE
    UTL_RAW
    UTL_TCP
    UTL_INADDR
    UTL_SMTP
    DBMS_TRANSACTION
    DBMS_SESSION
    DBMS_DDL
    DBMS_UTILITY
    DBMS_SPACE
    DBMS_ROWID
    DBMS_PCLXUTIL
    DBMS_APPLICATION_INFO
    DBMS_OUTPUT
    DBMS_DESCRIBE
    DBMS_SQL
    DBMS_EXPORT_EXTENSION
    DBMS_JOB
    DBMS_STATS
    DBMS_ZHELP_IR
    DBMS_PSP
    DBMS_RULE
    AQ$_AGENT
    AQ$_DEQUEUE_HISTORY
    AQ$_SUBSCRIBERS
    AQ$_RECIPIENTS
    AQ$_HISTORY
    AQ$_NOTIFY_MSG
    AQ$_DUMMY_T
    DBMS_AQ_EXP_QUEUE_TABLES
    DBMS_AQ_EXP_INDEX_TABLES
    DBMS_AQ_EXP_TIMEMGR_TABLES
    DBMS_AQ_EXP_HISTORY_TABLES
    DBMS_AQ_EXP_SUBSCRIBER_TABLES
    DBMS_AQ_EXP_QUEUES
    DBMS_AQ_IMP_INTERNAL
    DBMS_RMIN
    DBMS_RESOURCE_MANAGER
    DBMS_RESOURCE_MANAGER_PRIVS
    DBMS_RMGR_PLAN_EXPORT
    DBMS_RMGR_GROUP_EXPORT
    DBMS_RMGR_PACT_EXPORT
    LOW_GROUP
    DEFAULT_CONSUMER_GROUP
    DBMS_DEBUG_VC2COLL
    DBMS_DEBUG
    PBSDE
    DBMS_SUMMARY
    DBMS_SNAPSHOT
    DBMS_REFRESH
    DBMS_SNAPSHOT_UTL
    DBMS_REFRESH_EXP_SITES
    DBMS_REFRESH_EXP_LWM
    DBMS_TRACE
    DBMS_LOB
    UTL_REF
    UTL_COLL
    ODCIPREDINFO
    ODCIRIDLIST
    ODCIINDEXCTX
    ODCIARGDESCLIST
    ODCIFUNCINFO
    ODCISTATSOPTIONS
    ODCICOLINFOLIST
    ODCIOBJECT
    ODCIOBJECTLIST
    ODCIQUERYINFO
    ODCICONST
    SYSEVENT
    DICTIONARY_OBJ_TYPE
    DICTIONARY_OBJ_OWNER
    DICTIONARY_OBJ_NAME
    DATABASE_NAME
    INSTANCE_NUM
    LOGIN_USER
    IS_SERVERERROR
    SERVER_ERROR
    DES_ENCRYPTED_PASSWORD
    IS_ALTER_COLUMN
    IS_DROP_COLUMN
    GRANTEE
    REVOKEE
    PRIVILEGE_LIST
    WITH_GRANT_OPTION
    DICTIONARY_OBJ_OWNER_LIST
    DICTIONARY_OBJ_NAME_LIST
    IS_CREATING_NESTED_TABLE
    CLIENT_IP_ADDRESS
    DBMS_REPUTIL
    DBMS_REPUTIL2
    DBMS_OFFLINE_RGT
    DBMS_REPCAT_RGT_EXP
    DBMS_REPCAT_INSTANTIATE
    DBMS_CRYPTO_TOOLKIT
    DBMS_RANDOM
    how come it happens? need help from u all !!!!!!!!!!

    you asked why you have such grant found in dba_tab_privs. Let's try to find DBMS_RANDOM (listed on your output) in $ORACLE_HOME/rdbms/admin:
    cd $ORACLE_HOME/rdbms/admin
    grep dbms_random *
    dbmsrand.sql:CREATE OR REPLACE PACKAGE dbms_random AS
    dbmsrand.sql: -- execute dbms_random.seed(12345678);
    dbmsrand.sql: -- execute dbms_random.seed(TO_CHAR(SYSDATE,'MM-DD-YYYY HH24:MI:SS'));
    dbmsrand.sql: -- my_random_number := dbms_random.random;
    dbmsrand.sql: -- my_random_real := dbms_random.value;
    dbmsrand.sql: -- select dbms_random.value from dual;
    dbmsrand.sql: -- insert into a values (dbms_random.value);
    dbmsrand.sql: -- execute :x := dbms_random.value;
    dbmsrand.sql:END dbms_random;
    dbmsrand.sql:CREATE OR REPLACE PACKAGE BODY dbms_random AS
    dbmsrand.sql:END dbms_random;
    dbmsrand.sql:CREATE OR REPLACE PUBLIC SYNONYM dbms_random FOR sys.dbms_random;
    dbmsrand.sql:GRANT EXECUTE ON dbms_random TO public;
    This is run by catproc.sql script which you run while creating database.

  • Result set does not fit; it contains too many rows

    Dear All,
    We are in BI7 and running reports on Excel 2007. Even though number of rows limitation in Excel 2007 is more than  1Million, when I try to execute a report with more than 65k records of output, system is generating output only for 65k rows with message "Result set does not fit; it contains too many rows".
    Our Patch levels:
    GUI - 7.10
    Patch level is 11
    Is there any way to generate more than 65000 rows in Bex?
    Thanks in advance...
    regards,
    Raju
    Dear Gurus,
    Could you please shed some light on this issue?
    thanks and regards,
    Raju
    Edited by: VaraPrasadraju Potturi on Apr 14, 2009 3:13 AM

    Vara Prasad,
    This has been discussed on the forums - for reasons of backward compatibility I do not think BEx supports more that 65000 rows .... I am still not sure about the same since I have not tried out a query with more that 65K rows on excel 2007 but I think this is not possible...

  • List of Value: Best practice when there are too many rows.

    Hi,
    I am working in JDev12c. Imagine the following scenario. We have an employee table and the organization_id as one of its attributes. I want to set up a LOV for this attribute. For what I understand, if the Organization table contains too many rows, this will create an extreme overhead (like 3000 rows), also, would be impossible to scroll down in a simple LOV. So, I have decided the obvious option; to use the LOV as a Combo Box with List of Values. Great so far.
    That LOV will be use for each user, but it doesn't really depend of the user and the list of organization will rarely change. I have a sharedApplicationModule that I am using to retrieve lookup values from DB. Do you think would be OK to put my ORGANIZATION VO in there and create the View Accessor for my LOV in the Employees View?
    What considerations should I take in term of TUNING the Organization VO?
    Regards

    Hi Raghava,
    as I said, "Preparation Failed" may be (if I recall correctly) as early as the HTTP request to even get the document for indexing. If this is not possible for TREX, then of course the indexing fails.
    What I suggested was a manual reproduction. So log on to the TREX host (preferrably with the user that TREX uses to access the documents) and then simply try to open one of the docs with the "failed" status by pasting its address in the browser. If this does not work, you have a pretty good idea what's happening.
    Unfortunately, if that were the case, this would the be some issue in network communications or ticketing and authorizatuions, which I can not tell you from here how to solve.
    In any case, I would advise to open a support message to SAP - probably rather under the portal component than under TREX, as I do not assume that this stage of a queue error has anything to do with the actual engine.
    Best,
    Karsten

  • ExecuteQueryForObject returned too many results jdbc error

    Hi All,
    I am getting the following error on running the tomcat 6.0 and I have Oracle 11g installed.
    08 Dec 2010 16:23:41 ERROR [QUARTZ_Worker-5] org.quartz.core.JobRunShell - Job DCTM.DCTMServerPipe threw an unhandled Exception:
    org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results.
         at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
         at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:265)
         at com.emc.documentum.bpm.daos.impl.AbstractIbatisBaseDaoImpl.queryForObject(AbstractIbatisBaseDaoImpl.java:119)
         at com.emc.documentum.bpm.bamengine.daos.impl.ServerConfigDaoImpl.getDBCurrentTime(ServerConfigDaoImpl.java:28)
         at com.emc.documentum.bpm.bamengine.services.server.factory.impl.ServersFactoryImpl.updatePipeServerTimezoneOffset(ServersFactoryImpl.java:56)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
         at $Proxy50.updatePipeServerTimezoneOffset(Unknown Source)
         at com.emc.documentum.bpm.bamengine.services.sharedservices.impl.TaskManagerServiceImpl.executePipe(TaskManagerServiceImpl.java:341)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
         at $Proxy52.executePipe(Unknown Source)
         at com.emc.documentum.bpm.bamengine.scheduler.impl.PipeJobImpl.execute(PipeJobImpl.java:17)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Caused by: java.sql.SQLException: Error: executeQueryForObject returned too many results.
         at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:124)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
         at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
         at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
         ... 23 more
    How can this be resolved? Please help !!
    Thanks, T
    Edited by: 805903 on Dec 9, 2010 3:00 AM

    Error executeQueryForObject returned too many results
    Typical Error msg:
    “SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results”
    The error is caused for using queryForObject (for a single result) instead of queryForList (when expecting multiple results).
    Example of correct solution
    In DAO:
    public List<UpdatedContractRateDO> getUpdatedCtrctRate(Map paramMap) throws DataAccessException {
    return (List<UpdatedContractRateDO>) getSqlMapClientTemplate().queryForList("charge.getUpdatedCtrctRate", paramMap);
    }

Maybe you are looking for

  • Photoshop Elements 10 from the app store crashes every time I run it

    I bought Photoshop Elements 10 from the app store. When I try to run it, it crashes. My macbook is brand new (bought it March, 2012), with 8GB ram and a 256SSD. Here's the report: Process:         Adobe Photoshop Elements 10 Editor [247] Path:       

  • Query Regarding ALV - Very Urgent

    Hi experts, I have defined a ALV grid in my program using the startdard function module as editable. Now I want the grid to be displayed in the screen with my pf-status. how can i do that?. Here is the sample code. REPORT  zadvcformsub   NO STANDARD

  • ITunes 6 problem

    I didn't have a problem with the download or installation, but ever since I installed iTunes 6 iTunes won't open. I tried system restore, but that didn't work. Then I uninstalled iTunes then reinstalled it. And I still can't get it to open.

  • Cached Form Guide returned by Render Form Guide Service

    I am calling the Render Form Guide Web Service and passing in the form url and data. Even after making several edits to the form guide, the older version of form guide gets returned from the webservice call. How can I tell livecycle to make use of th

  • Configure XP firewall to use RMI

    I have a RMI server and client application. They run perfectly when Windows XP's Internet Connection Firewall (ICF) is disabled in Network Connections. However, when the ICF is enabled, client fails to connect to server and obviously I get connection