ORA-22813 on SELECT with ORDER BY

Hi all,
I have on a server Windows 2003 (3Gb RAM) an Oracle Database 9.2.0.1
Until last week all seems right, but now when i submit this SQL:
Select a,b,c,d,e... from mytable order by a,b
I have this error:
ORA-22813 "operand value exceeds system limits"
-If i remove a first or second column from order by clause
-If i remove a geometry column or some columns from the select
It works.
To fix this problem I have tried to:
Recreate any indexes (data and spatial), no result
Enable/Disable all costraints, no result
Set parameter hash_join_tables to true and false, no result
Enlarge the PGA, no result
Copy only 10 record in another blank table, no result
Export the table and import it in another database in another server (Windows 2003 / Oracle 9.2.0.1). The Export and Import are ok but the error is the same.
Can you help me? Have you any suggest?
Thanks

Error:     ORA-22813
Text:     operand value exceeds system limits
Cause:     Object or Collection value was too large. The size of the value might
     have exceeded 30k in a SORT context, or the size might be too big for
     available memory.
Action:     Choose another value and retry the operation.Has your data changed such that one of the recent values is hitting this limit.
Note also Metalink bug 5959987 Spatial aggregations fail with ORA-22813 which is only confirmed as being in 10.2.0.3 but says
ORA-22813 can occur when performing Spatial aggregations
(SDO_AGGR_UNION or SDO_AGGR_CONCAT_LINES)
when used with a GROUP BY clause and the input contains
geometries that occupy more than 32K."

Similar Messages

  • ORA-01652 and ORA-02063 in select with dblink

    Hello,
    I execute the following select in a Oracle database:
    SELECT HAC.ENT_ID, HAC.MAT, HAC.IDAC,
    NVL(HAC.DATINI, 0) AS DATINI, NVL(HAC.DATEND, 0) AS DATEND,
    HAC.TIP, GAP.IDAC AS IDAC_GAP, HAP.IDAC AS IDAC_HAP
    FROM USER1.GAP GAP, HAC@DBLINK HAC, HAP@DBLINK HAP
    WHERE
    HAC.IDAC IN (SELECT DISTINCT IDAC FROM USER1.GAC)
    AND HAC.IDAC = GAP.IDAC (+)
    AND HAC.IDAC = HAP.IDAC (+)
    GAP 157133 regs (873mb)
    GAC 13555 regs (462mb)
    HAC 57198111 regs (17985mb)
    HAP 3940407 regs (14184mb)
    GAP, GAC, HAC and HAP are views.
    The result is:
    ORA-01652: unable to extend temp segment by in tablespace
    ORA-02063: preceding line from DBLINK
    The tablespace temporal of the local database used is:
    TABLESPACE_NAME|USED_EXTENTS|USED_BLOCKS|FREE_EXTENTS|FREE_BLOCKS
    ATMP |0 |0 |3157 |409404
    It is this tablespace ATMP the one that fills
    The tablespace temporal of the remote database is:
    TABLESPACE_NAME|USED_EXTENTS|USED_BLOCKS|FREE_EXTENTS|FREE_BLOCKS
    HTMP |0 |0 |3157 |409404
    - Why happens this, and howto it is possible to solve?
    - How count the space consume by a select?
    - The select is not good? The intention of the select is to locate erroneous records and to count (dates and times) all the correct records.
    - How is it possible to use another temporary tablespace apart from of default of USER1, ATMP?
    - I have tried to divide also the select by the field MAT, but every select is late a lot of time, of the order of 4 minutes, and there are approximately 3000 MAT different
    - If a solution was to increase ATMP, all that needs?
    Thank you very much for the help,
    Cesar Jorge

    The explain plan is:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          316037 G          2836986                     
    MERGE JOIN          316037 G     35319894G     2836986                     
    MERGE JOIN OUTER          2916 G     298814G     2834816                     
    MERGE JOIN OUTER          2916 G     274366G     2834814                     
    SORT JOIN          5 M     498 M     1025633                     
    REMOTE          5 M     498 M     10551      DBLINK     SERIAL          
    SORT JOIN          51 M     440 M     1809181                     
    VIEW     USER1.GAP     51 M     440 M     864                     
    MERGE JOIN OUTER          51 M     1G     864                     
    TABLE ACCESS BY INDEX ROWID     USER1.T9 (of view USER1.GAP)     882 K     15 M     826                     
    INDEX FULL SCAN     USER1.IT9 (of view USER1.GAP) 12     882 K          26                     
    SORT JOIN          5 K     51 K     34                     
    INDEX FAST FULL SCAN     USER1.IB9 (of view USER1.GAP)     5 K     51 K     4                     
    SORT JOIN          82      738      3                     
    REMOTE          82      738      1      DBLINK     SERIAL          
    SORT JOIN          10 K     105 K     2170                     
    VIEW     SYS.VW_NSO_1     10 K     105 K     2067                     
    SORT UNIQUE          10 K     105 K     2067                     
    TABLE ACCESS FULL     USER1.T3 (of view USER1.GAC)     10 K     105 K     1964                     
    Regards

  • ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP

    In my data model (load from a database) there is this data control and its accessor return.
    When I drag the accessor return inside a jsf page I create a adf read only table (that has about 5000 rows), the I run the page and it works.
    Since I want to display only 20 ( or 50 or 100 is the same) rows for each page I had changed the access mode from the default value "Scrollable" to "Range Paging" and then I ve selected range size 50.
    Now if I run hte jsf page there are no data to display and if I press the small triangles to order the column or insert a word in the filter field I have the message ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP.
    I dont know how to do to solve this problem.
    Stefano

    An other thing.
    I solved this problem, maybe I dont understand the meaning of access mode and range size , since every value I choose of these 2 fields the visualization of the table doesnt change.

  • ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.

    Dears,
    i have this problem after i create tabular from depend on view
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    this a query that i use
    select
    "INVOICE_DET",
    "INVOICE_DET" INVOICE_DET_DISPLAY,
    "INVOICE_ID",
    "STORAGE_CODE",
    "ITEM_QNTY",
    "ITEM_PRICE",
    "BONS_QNTY",
    "DISC_VALUE",
    "TOT_VAL",
    "LOCATION_CODE",
    "BATCH_DET",
    "ITEM_CODE",
    "ITEM_NAME",
    "UOM_CODE",
    "UOM_NAME",
    "SIZE_CODE",
    "SIZE_NAME",
    "COLOR_CODE",
    "COLOR_NAME",
    "STOREG_BRCHAS_BATCHN",
    "EXPR_DATE",
    "PROD_DATE",
    "ITEM_DET_ID"
    from "#OWNER#"."BRCHAS_INVOICE_DET_VIEW"
    this the view i created
      CREATE OR REPLACE FORCE VIEW "RETAIL"."BRCHAS_INVOICE_DET_VIEW" ("INVOICE_DET", "INVOICE_ID", "STORAGE_CODE", "ITEM_QNTY", "ITEM_PRICE", "BONS_QNTY", "DISC_VALUE", "TOT_VAL", "LOCATION_CODE", "BATCH_DET", "ITEM_CODE", "ITEM_NAME", "UOM_CODE", "UOM_NAME", "SIZE_CODE", "SIZE_NAME", "COLOR_CODE", "COLOR_NAME", "STOREG_BRCHAS_BATCHN", "EXPR_DATE", "PROD_DATE", "ITEM_DET_ID") AS
      SELECT invoice_det, invoice_id, storage_code, item_qnty, item_price,
              bons_qnty, disc_value, tot_val, location_code, batch_det, item_code,
              item_name, uom_code, uom_name, size_code, size_name, color_code,
              color_name, storeg_brchas_batchn, expr_date, prod_date, item_det_id
         FROM (SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
                      d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
                      d.location_code, d.batch_det, i.item_code,
                      get_item_name (i.item_code) item_name, i.uom_code,
                      get_uom_desc (i.uom_code) uom_name, i.size_code,
                      get_size_name (i.size_code) size_name, i.color_code,
                      get_color_name (i.color_code) color_name,
                      dd.storeg_brchas_batchn, b.expr_date, b.prod_date,
                      i.item_det_id
                 FROM brchas_invoice_det d,
                      brchas_batch dd,
                      brchas_batch_det b,
                      item_uom_size_color i
                WHERE dd.storeg_brchas_batchinternn = b.storeg_brchas_batchinternn
                  AND d.batch_det = b.batch_det
                  AND b.item_det_id = i.item_det_id
                  AND d.batch_det IS NOT NULL
               UNION ALL
               SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
                      d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
                      d.location_code, d.batch_det, i.item_code,
                      get_item_name (i.item_code) item_name, i.uom_code,
                      get_uom_desc (i.uom_code) uom_name, i.size_code,
                      get_size_name (i.size_code) size_name, i.color_code,
                      get_color_name (i.color_code) color_name,
                      NULL storeg_brchas_batchn, NULL expr_date, NULL prod_date,
                      i.item_det_id
                 FROM brchas_invoice_det d, item_uom_size_color i
                WHERE d.item_det_id = i.item_det_id
                AND d.batch_det IS NULL) ;
      CREATE OR REPLACE TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG"
    INSTEAD OF DELETE OR INSERT OR UPDATE
    ON RETAIL.BRCHAS_INVOICE_DET_VIEW
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    V_PRICE NUMBER;
    V_BONUS_QNTY NUMBER;
    V_DISC_VAL NUMBER;
    BEGIN
      IF INSERTING THEN
          INSERT INTO BRCHAS_INVOICE_DET
          (INVOICE_DET,
          INVOICE_ID ,
          STORAGE_CODE,
          ITEM_QNTY,
          ITEM_PRICE,
          BATCH_DET,
          BONS_QNTY,
          TOT_VAL,
          LOCATION_CODE,
          DISC_VALUE,
          CREATED_USER,
          CREATED_DATE,
          ITEM_DET_ID
          VALUES
          ("BRCHAS_INVOICE_DET_SEQ".nextval,
          :NEW.INVOICE_ID ,
          :NEW.STORAGE_CODE,
          :NEW.ITEM_QNTY,
          :NEW.ITEM_PRICE,
          :NEW.BATCH_DET,
          :NEW.BONS_QNTY,
          (:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
          :NEW.LOCATION_CODE,
          :NEW.DISC_VALUE,
          nvl(v('APP_USER'),user),
          sysdate,
          :NEW.ITEM_DET_ID);
      ELSIF UPDATING THEN
            UPDATE BRCHAS_INVOICE_DET
            SET INVOICE_ID    =:NEW.INVOICE_ID,
                STORAGE_CODE  =:NEW.STORAGE_CODE,
                ITEM_QNTY     =:NEW.ITEM_QNTY,
                ITEM_PRICE    = :NEW.ITEM_PRICE,
                BATCH_DET     =:NEW.BATCH_DET,
                BONS_QNTY     = :NEW.BONS_QNTY,
                TOT_VAL       =(:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
                LOCATION_CODE =:NEW.LOCATION_CODE,
                DISC_VALUE    = :NEW.DISC_VALUE,
                ITEM_DET_ID =:NEW.ITEM_DET_ID
            WHERE INVOICE_DET =:NEW.INVOICE_DET;
      ELSE
            DELETE FROM BRCHAS_INVOICE_DET
             WHERE INVOICE_DET =:OLD.INVOICE_DET;
      END IF;
       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           RAISE;
    END BRCHAS_INVOICE_DET_VIEW_TRG;
    ALTER TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG" ENABLE;
    please i need help
    Thanks
    Ahmed

    Hi,
    This might help
    http://www.techonthenet.com/oracle/errors/ora01446.php
    Regards,
    Jari

  • You Cannot select assembly order for deletion error with BAPI_SALESORDER_CAHNGE after EHP6 upgrade

    Hi All,
    We are using Z transaction to update Wbs element data to sales order line item through BAPI_SALESORDER_CHANGE. After EHP6 upgrade while updating Wbs element data to old sales orders(Created before EHP6 upgrade)  we are getting  You cannot select assembly order < order number> for deletion (V1 748) error in BAPI return table, For multiple Sales order run.
    But if  we run the same order individually it is getting processed successfully. W e are passing the same values in individual and multiple case.
    We debugged the BAPI and found one more error related to Authorization, But BAPI return table is giving different error (V1 748)message. Please help us in finding the issue.

    Hi Sujay..
    Please check.
    http://help.sap.com/saphelp_47x200/helpdata/en/b7/58c4c87e0811d2b66a0000e82d8bd1/frameset.htm

  • Important--Bug(ORA-22813) fixes in Oracle Database 10g  Release 10.2.0.4

    Hi,
    I found that in SELECT STATEMENTs where we use "xmlagg() functions with a GROUP BY/ORDER BY,it fails with ORA-22813 if the result is too large.
    This happens as there is a hard coded limit on the result size. (max 30k)
    Next,i confirmed that and when i removed a portion of the XML agg() values and executed it---Wonders,it runs perfectly fine.
    This means that ""xmlagg() functions with a GROUP BY/ORDER BY,fails with ORA-22813 since the result is too large.
    I have come to know that patch "Release 10.2.0.4" has the fix for Bug-22813 for "xmlagg() functions with a GROUP BY/ORDER BY".
    Could you all please confirm that "Oracle Database 10g Release 10.2.0.4" (patch 10.2.04) fixes the issue?
    Based on your confirmation,i can go ahead to get the patch installed.
    Current Version:-Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    Thanks
    Mainak

    Your query should be written something like this..
    select d.*
      from fbnk_customer,
           XMLTABLE
              '//c3'
              passing XMLRECORD
              columns
              C3_VALUE varchar2(60) path 'text()'
           ) d
    where recid='1001400'; Although it would be better to use an extact path expression rather than '//c3'

  • For update with order by

    Hello all,
    Does anyone know if "order by" has precedence over "for update"? In other words, using the following query. Will the resulting rows be sorted first and then locked or they will be locked first and then sorted?
    SELECT /*+ cardinality(al 1) use_nl(al t) */ NULL
    BULK COLLECT INTO l_nullvalue_list
    FROM TABLE (i_list) al, my_table t
    WHERE al.id = t.id
    ORDER BY t.id
    FOR UPDATE OF t.id;
    Any help is very much appreciated.
    Regards,
    wf

    This is the case I'm talking about:
    drop table t cascade constraints purge;
    create table t as select rownum id, cast('x' as char(100)) pad
                        from dual connect by level <= 10000;
    drop table t1 cascade constraints purge;
    create table t1(id int);
    -- 1st session
    SQL> lock table t1 in exclusive mode;
    Table(s) locked
    -- 2nd session
    declare
        type t1_type is table of rowid index by binary_integer;
        l_tab t1_type;
    begin
        execute immediate 'lock table t1 in share mode';
        select rowid bulk collect into l_tab
          from t order by dbms_random.value
           for update;
    end;
    -- 3rd session
    declare
        type t1_type is table of rowid index by binary_integer;
        l_tab t1_type;
    begin
        execute immediate 'lock table t1 in share mode';
        select rowid bulk collect into l_tab
          from t order by dbms_random.value
           for update;
    end;
    /Now 2nd & 3rd sessions are blocked by 1st. Let's release that lock:
    -- 1st session
    SQL> commit;
    Commit complete2nd & 3rd sessions are trying to lock rows of table T, and one of sessions fails with deadlock:
    declare
        type t1_type is table of rowid index by binary_integer;
        l_tab t1_type;
    begin
        execute immediate 'lock table t1 in share mode';
        select rowid bulk collect into l_tab
          from t order by dbms_random.value
           for update;
    end;
    ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at line 7If you repeat the same scenario with ORDER BY id, then one session will be waiting for enqueue.
    So, it's all about order in which row locks are acquired.

  • ORA 22813 in merge statement

    hi gems..good afternoon...
    My database version is 11.2.0.1.0 64 bit Solaris OS.
    I am facing an "ORA-22813: operand value exceeds system limits" while running a procedure.
    I have used loggers and found that it is getting failed in a MERGE statement.
    That merge statement is used to merge a table with a collection. the code is like below:
    MERGE /*+ INDEX(P BALANCE_HISTORIC_INDEX) */
        INTO BALANCE_HOLD_HISTORIC P
        USING TABLE(GET_BALANCE_HIST(V_MERGE_REC)) M
        ON (P.CUSTOMER_ID = M.CUSTOMER_ID AND P.BOOK_ID = M.BOOK_ID AND P.PRODUCT_ID = M.PRODUCT_ID AND P.SUB_BOOK_ID = M.SUB_BOOK_ID AND)
        WHEN MATCHED THEN
          UPDATE
             <set .....>
        WHEN NOT MATCHED THEN
          INSERT<.....>The parameter of the function GET_BALANCE_HIST(V_MERGE_REC) is a table type.
    Now the function GET_BALANCE_HIST(V_MERGE_REC) is a pipelined function and we have used that because the collection V_MERGE_REC may get huge with data.
    This proc was running fine from the beginning but from day before yesterday it was continously throwing ORA 22813 error in that line.
    please help..thanks in advance..

    hi paul..thanks for your reply...
    the function GET_BALANCE_HIST is not selecting data from any tables.
    What this pipeline function is doing is, it is taking the huge collection V_MERGE_REC as parameter and releasing its datas in pipelined form. The code for the functions is :
    CREATE OR REPLACE FUNCTION GET_BALANCE_HIST(P_MERGE IN TAB_TYPE_BALANCE_HISTORIC)
      RETURN TAB_TYPE_BALANCE_HISTORIC
      PIPELINED AS
      V_MERGE TAB_TYPE_BALANCE_HISTORIC := TAB_TYPE_BALANCE_HISTORIC();
    BEGIN
      FOR I IN 1 .. P_MERGE.COUNT LOOP
        V_MERGE.EXTEND;
        V_MERGE(V_MERGE.LAST) := OBJ_TYPE_BALANCE_HISTORIC(P_MERGE(I).CUSTOMER_ID,
                                                 P_MERGE(I).BOOK_ID,
                                                 P_MERGE(I).PRODUCT_ID,
                                                 P_MERGE(I).SUB_BOOK_ID,
                                                 P_MERGE(I).EARNINGS,
                                                 P_MERGE(I).EARNINGS_HOUSE,
                                                 P_MERGE(I).QUANTITY,
                                                 P_MERGE(I).ACCOUNT_INTEGER);
      END LOOP;
      FOR J IN 1 .. V_MERGE.COUNT LOOP
        PIPE ROW(OBJ_TYPE_BALANCE_HISTORIC(V_MERGE(I).CUSTOMER_ID,
                                                 V_MERGE(I).BOOK_ID,
                                                 V_MERGE(I).PRODUCT_ID,
                                                 V_MERGE(I).SUB_BOOK_ID,
                                                 V_MERGE(I).EARNINGS,
                                                 V_MERGE(I).EARNINGS_HOUSE,
                                                 V_MERGE(I).QUANTITY,
                                                 V_MERGE(I).ACCOUNT_INTEGER));
      END LOOP;
      RETURN;
    END;I think the error is comming because of the parameter value of V_MERGE_REC. Since it is huge, so loading that into memory is causing problem. But in this case, how can I resolve it?? Can I use a global temporary table for this??
    Please suggest...

  • Ora-22813 in oracle 11g

    Hi all
    db version 11.2.0.1.0
    OS : Windows 2003 64bit
    We are getting this error ora-22813 in oracle 11g
    thanks

    Hi Pavan
    this is the query executed by user
    select * from
    select admin.*,
    DENSE_RANK() OVER (partition by ctry ORDER BY feattyp) AS spro_admin_layer
    from
    select a_union.* from
    select ctry, feattyp, 'MN_A0' tbl_name, name, namelc, order00, id, geom from mn_a0 union all
    select ctry, feattyp, 'MN_A1' tbl_name, name, namelc, order01, id, geom from mn_a1 union all
    select ctry, feattyp, 'MN_A2' tbl_name, name, namelc, order02, id, geom from mn_a2 union all
    select ctry, feattyp, 'MN_A7' tbl_name, name, namelc, order07, id, geom from mn_a7 union all
    select ctry, feattyp, 'MN_A8' tbl_name, name, namelc, order08, id, geom from mn_a8 union all
    select ctry, feattyp, 'MN_A9' tbl_name, name, namelc, order09, id, geom from mn_a9
    ) a_union
    ) admin
    ) where (ctry='ITA' or ctry='SMR') and spro_admin_layer = 2
    thanks

  • Problem with order by clause

    Hai all,
    I have problem with order by clause,
    My query is
    "select number from table1 order by number asc "
    and the output is displaying as
    1
    10
    12
    13
    15
    17
    19
    2
    20
    21
    22
    But if we give order by it should display as below only right ?
    1
    2
    10
    12
    13
    15
    17
    19
    20
    21
    22 ........
    Please help me why it is not displaying like it. and how to make the statement to display like the second case. Thanks in advance.
    Regards,
    Uraja

    The column datatype that you are selecting is not of NUMBER datatype(might be char or varchar2) hence you are getting such result set.
    And for this purpose, it is recommended to set datatype of a column appropriately.
    For now you can add TO_NUMBER function to column in ORDER BY clause, only if it has data of number type.
    Edited by: Ora on 19 Nov, 2012 3:10 AM

  • ORA-22813 error when deleting spatial objects in LIVE

    Hi,
    We are getting an ORA-22813 error when attempting to delete a spatial object from a version-enabled table in workspace LIVE. The spatial object to be removed has a SDO type of multipolygon. The geometry information consists of 4 rings with a combined ordinate count of 4120. The statement used to delete the row is:
    delete from tableA where tableA.id in (select tableA.id from tableA where tableA.id = 3);
    The error occurs only on a 10g R1 Oracle instance (10.1.0.5.0) with Workspace Manager version 10.1.0.7.1. The delete operation succeeds without problems on a 10g R2 (10.2.0.2.0) instance with Workspace Manager version 10.2.0.3.1. The statement is also executed successfully on the 10g R1 instance if the table is not version-enabled.
    Any help on this would be appreciated.
    Thanks

    Hi,
    I would recommend filing a TAR in this one. The only ora-22813 error involving workspace manager and geometry columns that I know about involves queries that need to sort data for which the size of the geometry column was >30k. Does the execution plan for the delete statement involve any kind of sort? However, this is an old 9.2 bug, that I believe was fixed for all 10.1 and newer releases.
    Does the same error happen if you do not use the subquery?
    Regards,
    Ben

  • Ora 01446 cannot select rowid from, or sample....

    Hi All,
    I get this error if I try to test my query. "ora 01446 cannot select ROWID from, or sample, a view with DISTINCT,GROUP BY,etc"..Can anyone tell me what does this error represent and how will i be able to resolve it.
    FYI the jDeveloper version is 11.1.1.4.0

    Hi Timo,
    I faced this error while creating a view object. Yes its working fine in SQL worksheet.
    The query looks as below:
    SELECT DISTINCT Wfcommentsentity.UPDATEDBY,A.UPDATEDBYDISPLAYNAME,Wfcommentsentity.COMMENTDATE,Wfcommentsentity.TASKID,Wfcommentsentity.ROWID FROM WFCOMMENTS Wfcommentsentity,
    (SELECT DISTINCT UPDATEDBYDISPLAYNAME, UPDATEDBY,TASKID FROM WFTASKHISTORY WHERE TASKID = :Task_Id OR TASKGROUPID = :Task_Id)A
    WHERE A.UPDATEDBY = Wfcommentsentity.UPDATEDBY
    AND A.TASKID = Wfcommentsentity.TASKID order by Wfcommentsentity.ROWID

  • Unique record to display, with ORDER BY

    Table order
    Order_Number, Cust_Name
    222, XYZ
    223, XYZ
    224, ABC
    Table Product
    Order_Number, p_name
    222, p1
    222, p2
    222, p3
    223, p1
    223, p4
    here i need to display only 2 records (1 record for one order number) but with ORDER BY as below
    SELECT Order_Number, Cust_Name
    FROM order o
    INNER JOIN Product p ON (o.Order_Number = p.Order_Number)
    WHERE o.Cust_Name = 'XYZ'
    ORDER BY p_name;
    1) If i put DISTINCT, below error
    SQL Error: ORA-01791: not a SELECTed expression
    01791. 00000 - "not a SELECTed expression"
    2) If i put GROUP BY, below error
    SQL Error: ORA-00979: not a GROUP BY expression
    00979. 00000 - "not a GROUP BY expression"
    please help me to form the query

    Try this
    select o.order_number, o.cust_name
      from (
    select o.*,p.*, row_number() over(partition by o.order_number order by p.p_name)
      from order o
      join product p
        on o.order_number = p.order_number
    where o.cust_name = 'XYZ'
    where rno = 1

  • ORA-22813 ?

    Hi,
    I've run into an interesting ORA-22813 error. I ran the following SQL aginst an xmltype table.
    SQL> select
    2 extractValue(value(a), '/GTP/TransmissionSource@ID') TransmissionSourceID,
    3 extractValue(value(a), '/GTP/TransmissionSource@Name') TransmissionSourceName,
    4 extractValue(value(b), '/Study@ID') StudyID,
    5 extractValue(value(b), '/Study@Name') StudyName,
    6 extractValue(value(b), '/Study@TransmissionType') StudyTransmissionType,
    7 extractValue(value(c), '/Site@ID') SiteID,
    8 extractValue(value(d), '/Investigator@ID') InvestigatorID,
    9 extractValue(value(d), '/Investigator@Name') InvestigatorName
    10 from gtp x,
    11 table(xmlsequence(extract(value(x),'/GTP'))) a,
    12 table(xmlsequence(extract(value(x),'/GTP/Study'))) b,
    13 table(xmlsequence(extract(value(x),'/GTP/Study/Site'))) c,
    14 table(xmlsequence(extract(value(x),'/GTP/Study/Site/Investigator'))) d
    15 /
    select
    extractValue(value(a), '/GTP/TransmissionSource@ID') TransmissionSourceID,
    extractValue(value(a), '/GTP/TransmissionSource@Name') TransmissionSourceName,
    extractValue(value(b), '/Study@ID') StudyID,
    extractValue(value(b), '/Study@Name') StudyName,
    extractValue(value(b), '/Study@TransmissionType') StudyTransmissionType,
    extractValue(value(c), '/Site@ID') SiteID,
    extractValue(value(d), '/Investigator@ID') InvestigatorID,
    extractValue(value(d), '/Investigator@Name') InvestigatorName
    from gtp x,
    table(xmlsequence(extract(value(x),'/GTP'))) a,
    table(xmlsequence(extract(value(x),'/GTP/Study'))) b,
    table(xmlsequence(extract(value(x),'/GTP/Study/Site'))) c,
    table(xmlsequence(extract(value(x),'/GTP/Study/Site/Investigator'))) d
    ORA-22813: operand value exceeds system limits
    SQL>
    Not sure how to get around this one? The query was correctly a number of times without any issue.
    Also, I've got over ~90 SYS_IOT_OVER_39#### and ~70 SYS_NT+qzhFuERTRio9lfg061upw== bla, bal table objects.
    Not sure what these are?
    Thanks.

    OK
    A number of questions. I assume GTP only occurs once per document (eg is the root node), in which case there is no point to 'sequencing' GTP.
    I'm assuming that Study can occur more than once with GTP, and Site more than once within Study and Investigator more than once with Site.
    If the above is true the problem may be caused by the way you are constructing your sequences. XMLSequence relies on a correlated join. Hence each level of nesting should be obtained as a subset of the previous level. In your case you are creating a cartesian product which may explain the error...
    Try the following
    select
    extractValue(value(x), '/GTP/TransmissionSource@ID') TransmissionSourceID,
    extractValue(value(x), '/GTP/TransmissionSource@Name') TransmissionSourceName,
    extractValue(value(study), '/Study@ID') StudyID,
    extractValue(value(study), '/Study@Name') StudyName,
    extractValue(value(study), '/Study@TransmissionType') StudyTransmissionType,
    extractValue(value(site), '/Site@ID') SiteID,
    extractValue(value(investigator), '/Investigator@ID') InvestigatorID,
    extractValue(value(d), '/Investigator@Name') InvestigatorName
    from gtp x,
    table(xmlsequence(extract(value(x),'/GTP/Study'))) study,
    table(xmlsequence(extract(value(study),'/Study/Site'))) site,
    table(xmlsequence(extract(value(site),'Site/Investigator'))) investigator
    The tables you see imply that you have 70 different collections within your XML Schema.

  • Database selection with invalid cursor !

    hi experts,
        When  execute SAP BW processchar, it occur some system error: (sm21)
    Database selection with invalid cursor
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed).
    this error occur when apply bw support package 19.
    sap notes 1118584 Solution is: Import Support Package 17 . but my support package is 19.
    how can i solve this error?
    thanks,
    xwu.

    I am only assuming things, but it might be worth to look closely if you were experiencing an ORA- error during the execution. This could have caused a rollback and thus closed the cursor. Please check the job log, the workprocess trace (dev_wX file) and the system log SM21 and ST22 as well.
    Besides that check the oracle alertlog and the usertrace destination.
    Best regards, Michael

Maybe you are looking for

  • Creative Zen 32GB playlist sorting

    I just bought the plain Zen 32GB. Not the Zen this or that. Just plain Zen. When I go to manage playlists on my computer (Windows XP), the only way I can see to sort playlists is by dragging items up and down. There have to be other ways that I'm mis

  • Facebook Bug on KK 14.3.A.0.757

    I don't know if this is the right section to post this but I observed this bug on the latest stock ROM KK 14.3.A.0.757. Whenever I open chat and try to send a voice message it freezes and force close and won't sent the message. Reopening the FB app t

  • Account Modification in omr0

    Dear Forum, In omr0, go to simulation and click on account assignment. 1 May I know what does -e- at AM(account modification) mean? Also when it is empty also what does it mean? 2 May I know what does -Missing- at GL account field? Some are empty som

  • Problem with client authentification

    hi! I try to authenticate using SASL "External" and SSL. The SSL connection works fine, also SASL when using "Digest-MD5" but when I try to authenticate using "External" I get connected as anonymous. Here is what I did: I created a self-signed certif

  • Time Machine / capsule Error.... help!

    Hi all, I have had a time capsule for a while now and had no problems (apart from filling it up and needing to delete the contents - which I have done a good few weeks ago). Anyway all of a sudden this morning I am getting 2 error messages. _The Firs