I want to make performance fast of this query.

Hello friends,
I have used following queries in my 9 screen interactive report.Output/result is perfect but performance became damn slow.
I have used........(note : T2 is internal table)
SELECT VBELN INTO (T2-VBELN) FROM VBAK WHERE
AUART IN AUART AND  VBELN IN VBELN.
SELECT  NETWR POSNR INTO (T2-NETWR,T2-POSNR) FROM VBAP
WHERE  VBELN = T2-VBELN .
  SELECT AUFNR KDPOS PSMNG WEMNG INTO (T2-AUFNR,T2-KDPOS,T2-PSMNG,  T2-WEMNG) FROM AFPO WHERE KDAUF =  T2-VBELN .
    SELECT  DMBTR MATNR MENGE ELIKZ INTO (T2-DMBTR,T2-MATNR,T2-MENGE,T2-ELIKZ) FROM AUFM WHERE AUFNR = T2-AUFNR AND ELIKZ <> 'X'.
    SELECT SINGLE MAKTX INTO (T2-MAKTX) FROM MAKT
    WHERE MATNR = T2-MATNR.
      APPEND T2.
    ENDSELECT.
  ENDSELECT.
ENDSELECT.
ENDSELECT.
Please sujjest me the any other option for this query.
Thanks in advance.
Regards,
n.i.m.z.

Hi,
Please have a look at this code and see if it helps you. You will have to test this code properly as I could not do that due to the fact that I do not have any relevant data on my system. Please let me know if this helps you and do not forget to reward points if this was helpful.
TABLES: vbak.
SELECT-OPTIONS: vbeln FOR vbak-vbeln,
                auart FOR vbak-auart.
DATA: BEGIN OF t2 OCCURS 0,
        vbeln TYPE vbak-vbeln,
        posnr TYPE vbap-posnr,
        netwr TYPE vbap-netwr,
        aufnr TYPE afpo-aufnr,
        kdpos TYPE afpo-kdpos,
        psmng TYPE afpo-psmng,
        wemng TYPE afpo-wemng,
        dmbtr TYPE aufm-dmbtr,
        matnr TYPE aufm-matnr,
        menge TYPE aufm-menge,
        elikz TYPE aufm-elikz,
        maktx TYPE makt-maktx,
      END OF t2,
      BEGIN OF t_vbak OCCURS 0,
        vbeln TYPE vbak-vbeln,
      END OF t_vbak,
      BEGIN OF t_vbap OCCURS 0,
        vbeln TYPE vbap-vbeln,
        posnr TYPE vbap-posnr,
        netwr TYPE vbap-netwr,
      END OF t_vbap,
      BEGIN OF t_afpo OCCURS 0,
        kdauf TYPE afpo-kdauf,
        kdpos TYPE afpo-kdpos,
        aufnr TYPE afpo-aufnr,
        posnr TYPE afpo-posnr,
        psmng TYPE afpo-psmng,
        wemng TYPE afpo-wemng,
      END OF t_afpo,
      BEGIN OF t_aufm OCCURS 0,
        aufnr TYPE aufm-aufnr,
        mblnr TYPE aufm-mblnr,
        mjahr TYPE aufm-mjahr,
        zeile TYPE aufm-zeile,
        dmbtr TYPE aufm-dmbtr,
        matnr TYPE aufm-matnr,
        menge TYPE aufm-menge,
        elikz TYPE aufm-elikz,
      END OF t_aufm,
      BEGIN OF t_makt OCCURS 0,
        matnr TYPE makt-matnr,
        maktx TYPE makt-maktx,
      END OF t_makt,
      t_afpo_tmp LIKE TABLE OF t_afpo,
      t_aufm_tmp LIKE TABLE OF t_aufm.
REFRESH t2.
SELECT vbeln
  FROM vbak
  INTO TABLE t_vbak
  WHERE vbeln IN vbeln
  AND   auart IN auart.
IF sy-subrc EQ 0.
  SORT t_vbak BY vbeln.
  SELECT vbeln
         posnr
         netwr
    FROM vbap
    INTO TABLE t_vbap
    FOR ALL ENTRIES IN t_vbak
    WHERE vbeln EQ t_vbak-vbeln.
  IF sy-subrc EQ 0.
    SORT t_vbap BY vbeln
                   posnr.
    SELECT kdauf
           kdpos
           aufnr
           posnr
           psmng
           wemng
      FROM afpo
      INTO TABLE t_afpo
      FOR ALL ENTRIES IN t_vbap
      WHERE kdauf EQ t_vbap-vbeln
      AND   kdpos EQ t_vbap-posnr.
    IF sy-subrc EQ 0.
      SORT t_afpo BY kdauf
                     kdpos.
      t_afpo_tmp[] = t_afpo[].
      SORT t_afpo_tmp BY aufnr.
      DELETE ADJACENT DUPLICATES FROM t_afpo_tmp COMPARING aufnr.
      SELECT aufnr
             mblnr
             mjahr
             zeile
             dmbtr
             matnr
             menge
             elikz
        FROM aufm
        INTO TABLE t_aufm
        FOR ALL ENTRIES IN t_afpo_tmp
        WHERE aufnr EQ t_afpo_tmp-aufnr.
      IF sy-subrc EQ 0.
        DELETE t_aufm WHERE elikz EQ 'X'.
        SORT t_aufm BY aufnr.
        IF NOT t_aufm[] IS INITIAL.
          t_aufm_tmp[] = t_aufm[].
          SORT t_aufm_tmp[] BY matnr.
          DELETE ADJACENT DUPLICATES FROM t_aufm_tmp COMPARING matnr.
          SELECT matnr
                 maktx
            FROM makt
            INTO TABLE t_makt
            FOR ALL ENTRIES IN t_aufm_tmp
            WHERE matnr EQ t_aufm_tmp-matnr
            AND   spras EQ sy-langu.
          IF sy-subrc EQ 0.
            SORT t_makt BY matnr.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.
IF t_makt[] IS INITIAL.
  MESSAGE e208(00) WITH 'No records found'.
ELSE.
  LOOP AT t_vbap.
    READ TABLE t_afpo WITH KEY kdauf = t_vbap-vbeln
                               kdpos = t_vbap-posnr
                               BINARY SEARCH
                               TRANSPORTING
                                 kdpos
                                 aufnr
                                 psmng
                                 wemng.
    IF sy-subrc EQ 0.
      READ TABLE t_aufm WITH KEY aufnr = t_afpo-aufnr
                                 BINARY SEARCH
                                 TRANSPORTING
                                   dmbtr
                                   matnr
                                   menge
                                   elikz.
      IF sy-subrc EQ 0.
        READ TABLE t_makt WITH KEY matnr = t_aufm-matnr
                                   BINARY SEARCH
                                   TRANSPORTING
                                     maktx.
        IF sy-subrc EQ 0.
          t2-vbeln = t_vbap-vbeln.
          t2-posnr = t_vbap-posnr.
          t2-netwr = t_vbap-netwr.
          t2-aufnr = t_afpo-aufnr.
          t2-kdpos = t_afpo-kdpos.
          t2-psmng = t_afpo-psmng.
          t2-wemng = t_afpo-wemng.
          t2-dmbtr = t_aufm-dmbtr.
          t2-matnr = t_aufm-matnr.
          t2-menge = t_aufm-menge.
          t2-elikz = t_aufm-elikz.
          t2-maktx = t_makt-maktx.
          APPEND t2.
          CLEAR  t2.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDIF.
Regards,
Mark

Similar Messages

  • "Missing Sync Listener wants to make changes" what does this mean and should I submit my password?

    What does this message mean Missing Sync Listener wants to make changes" and should I submit my password?

    With the amount of information you've provided it's impossible to offer a solution.  We can't see your computer so we need to know the details of your problem and setup, i.e.:
    what version of iPhoto are you using?
    what system version are you running?
    what are you seeing the exclamation point?  When you double click on a thumbnail?
    what fixes have you tried?
    where is your library located?
    did you apply any updates or upgrades just prior to the problem occurring?
    are you running a "managed" or "referenced" library?
    what type of Mac?
    how much free space on your boot drive?

  • Performance issue in this query:

    Hi,
    Here is the query:
    SELECT COLLECTIONKEY, FLOWSYSKEY, LIFECYCLENUMBER, PUBLICVERSION, PUBLICOPERATION,
    STATUSCODE, VALUEDATE, REASONCODE FROM AA out WHERE COLLECTIONKEY
    LIKE '1437023L%' AND COLLECTIONVERSION = ( SELECT MAX(COLLECTIONVERSION) FROM cfdg_owner.AA inn WHERE inn.FLOWSYSKEY=out.FLOWSYSKEY)
    Now this table AA has non clustered index on CollectionKey and CollectionVersion.
    The above query will return only 4 records, but still the optimizer is using index .
    Fyi, AA table is huge table with records in millions.
    SELECT STATEMENT     8.0     8     58591     1     108     8                         ALL_ROWS                                                       
    FILTER                              1                                                                                
    TABLE ACCESS (BY INDEX ROWID)     5.0     5     36827     2     216     1     CFDG_OWNER     TB_PUBLIC_CF     BY INDEX ROWID     TABLE     ANALYZED     1                                                  
    INDEX (RANGE SCAN)     3.0     3     21764     2          1     CFDG_OWNER     IDX2_TB_PUBLIC_CF     RANGE SCAN     INDEX     ANALYZED                    1                                   
    SORT (AGGREGATE)                    1     41     2               AGGREGATE                                                                 
    INDEX (RANGE SCAN)     3.0     3     21764     1     41     1     CFDG_OWNER     IDX1_TB_PUBLIC_CF     RANGE SCAN     INDEX     ANALYZED                    1
    Plus the response time of this query is very fast. When i am forcing optimizer not to use Index, its taking more time.
    How come Index range scan is performing better in this case as compared to FULL Scan?
    Version is:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for Solaris: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Any more information required, please let me know.
    Thanks.
                                                      1

    It only returns 4 records, but how many does it have to scan through and eliminate to satisfy the MAX condition? ie) how many versions are there per key?
    It's quite possible this would be a more efficient query for you (it will obviate the secondary index range scan the current query is utilizing).
    SELECT
      COLLECTIONKEY,
      FLOWSYSKEY,
      LIFECYCLENUMBER,
      PUBLICVERSION,
      PUBLICOPERATION,
      STATUSCODE,
      VALUEDATE,
      REASONCODE
    FROM
      SELECT
        COLLECTIONKEY,
        FLOWSYSKEY,
        LIFECYCLENUMBER,
        PUBLICVERSION,
        PUBLICOPERATION,
        STATUSCODE,
        VALUEDATE,
        REASONCODE,
        COLLECTIONVERSION,
        MAX(COLLECTIONVERSION) OVER (PARTITION BY FLOWSYSKEY) AS MAX_COLLECTIONVERSION
      FROM AA
      WHERE COLLECTIONKEY LIKE '1437023L%'
    WHERE COLLECTIONVERSION = MAX_COLLECTIONVERSION;But without knowing a lot more about your data distributions, etc... it's just a guess.

  • Performance issue with this query.

    Hi Experts,
    This query is fetching 500 records.
    SELECT
    RECIPIENT_ID ,FAX_STATUS
    FROM
    FAX_STAGE WHERE LOWER(FAX_STATUS) like 'moved to%'
    Execution Plan
    | Id  | Operation                   | Name                | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT            |                     |   159K|    10M|  2170   (1)|
    |   1 |  TABLE ACCESS BY INDEX ROWID| FAX_STAGE           |   159K|    10M|  2170   (1)|
    |   2 |   INDEX RANGE SCAN          | INDX_FAX_STATUS_RAM | 28786 |       |   123   (0)|
    Note
       - 'PLAN_TABLE' is old version
    Statistics
              1  recursive calls
              0  db block gets
             21  consistent gets
              0  physical reads
              0  redo size
            937  bytes sent via SQL*Net to client
            375  bytes received via SQL*Net from client
              3  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             19  rows processed
    Total number of records in the table.
    SELECT COUNT(*) FROM FAX_STAGE--3679418
    Distinct reccords are low for this column.
    SELECT DISTINCT FAX_STATUS FROM FAX_STAGE;
    Completed
    BROKEN
    Broken - New
    moved to - America
    MOVED to - Australia
    Moved to Canada and australia
    Functional based indexe on FAX_STAGE(LOWER(FAX_STATUS))
    stats are upto date.
    Still the cost is high
    How to improve the performance of this query.
    Please help me.
    Thanks in advance.

    With no heavy activity on your fax_stage table a bitmap index might do better - see  CREATE INDEX
    I would try FTS (Full Table Scan) first as 6 vs. 3679418 is low cardinality for sure so using an index is not very helpful in this case (maybe too much Exadata oriented)
    There's a lot of web pages where you can read: full table scans are not always evil and indexes are not always good or vice versa Ask Tom &amp;quot;How to avoid the full table scan&amp;quot;
    Regards
    Etbin

  • Lenovo ThinPad S1 Yoga want to make it faster.

    Hello everyone, I just came into the Lenovo community the other day when i bought my LEnovo Thnkpad s1 yoga. i got the i5 version with up to 2.90 mhz. i know this is not a gaming computer but i would like to do some games on it, i was wondering if you guys could help me with the setting i could change or anything at all to make it better, so that downloaded games dont lag so much. An example of a game that i am trying to play is Spin Tires. hopefully you all can help i reall yappreciate it!

    If you want to enhance your gaming experience by using the touchscreen you might also like GestureWorks. For example, by using this you can play Call of Duty or Counter-Strike Source by only using the touchscreen.
    I am about to get it on Monday or Tuesday. Maybe it's something for you.
    Jonas
    Microsoft MVP: Windows Consumer Expert
    Yoga Tablet 2 10 || ThinkPad X1 Carbon (20A7007MPH) || ThinkPad Helix (3698-6EU) || IdeaCentre B540
    Twitter: @jonashendrickx

  • How do I get my MacBook Pro to recognise a movie file.  It plays on my PC and on the Windows programme installed on the Mac but I want to make a iDVD using this movie - it is a movie of my daughter's wedding. Ihave been able to make one using Windows Medi

    Hi, I would like to know what suffix I need to put on my movie file so that I can use it in iMovie or iDVD.  The movie file has .avi on it and can be read on Windows Media Player but I cannot get it into a file on the MacBook Pro such as iPhoto or iMovie.  It says the file is unrecognisable.  Please can you help??

    The free MPEG Streamclip and the free component from http://perian.org can convert your AVI to a format understood by iMovie.

  • Any way to materialize with fast refresh this query?

    I have three tables, A, B, C
    my query is:
    select
    from
    A
    inner join B on B.col=A.col
    left join C on C.b_id=B.id and C.a_id=A.id
    in essence, C is overriding a value from B in case it exists. I use this join often so I'd like to materialize it for performance reasons. The problem is, Mview requires traditional syntax (why is that??) which does not support joining C on two tables. Any way around this?
    Thanks

    Jernej Kase wrote:
    The problem is, Mview requires traditional syntax (why is that??) which does not support joining C on two tables. Any way around this?Hi Jernej,
    Your analysis is right. I don't know why MV's don't support ANSI join syntax, but I have encountered it before. Probably because when MV's where introduced, the ANSI join didn't exist in Oracle yet. But there is a way around this.
    First, reproducing your situation:
    SQL> create table a(id,col)
      2  as
      3  select 1, 'name 1' from dual union all
      4  select 2, 'name 2' from dual union all
      5  select 3, 'name 3' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table b (id,col)
      2  as
      3  select 1, 'name 1' from dual union all
      4  select 2, 'name 2' from dual union all
      5  select 3, 'name 3' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table c (a_id,b_id,col)
      2  as
      3  select 2, 2, 'name c2' from dual union all
      4  select 3, 3, 'name c3' from dual union all
      5  select 4, 4, 'name c4' from dual
      6  /
    Tabel is aangemaakt.
    SQL> alter table a add primary key (id)
      2  /
    Tabel is gewijzigd.
    SQL> alter table b add primary key (id)
      2  /
    Tabel is gewijzigd.
    SQL> alter table c add primary key (a_id,b_id)
      2  /
    Tabel is gewijzigd.
    SQL> select
      2  *
      3  from
      4  A
      5  inner join B on B.col=A.col
      6  left join C on C.b_id=B.id and C.a_id=A.id
      7  /
       ID COL       ID COL     A_ID  B_ID COL
        1 name 1     1 name 1
        2 name 2     2 name 2     2     2 name c2
        3 name 3     3 name 3     3     3 name c3
    3 rijen zijn geselecteerd.
    SQL> create materialized view log on a with rowid
      2  /
    Gematerialiseerde viewlog is aangemaakt.
    SQL> create materialized view log on b with rowid
      2  /
    Gematerialiseerde viewlog is aangemaakt.
    SQL> create materialized view log on c with rowid
      2  /
    Gematerialiseerde viewlog is aangemaakt.
    SQL> create materialized view abc_mv
      2    refresh fast on commit
      3  as
      4  select a.rowid a_rowid
      5       , b.rowid b_rowid
      6       , c.rowid c_rowid
      7       , a.id    a_id
      8       , b.id    b_id
      9       , a.col   a_col
    10       , b.col   b_col
    11       , c.col   c_col
    12    from A
    13         inner join B on B.col=A.col
    14         left join C on C.b_id=B.id and C.a_id=A.id
    15  /
           left join C on C.b_id=B.id and C.a_id=A.id
    FOUT in regel 14:
    .ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized viewTo circumvent this error message, the only option I see is to use nested MV's like this:
    SQL> create materialized view ab_mv
      2    refresh fast on commit
      3  as
      4  select a.rowid a_rowid
      5       , b.rowid b_rowid
      6       , a.id    a_id
      7       , b.id    b_id
      8       , a.col   a_col
      9       , b.col   b_col
    10    from a
    11       , b
    12   where a.col = b.col
    13  /
    Gematerialiseerde view is aangemaakt.
    SQL> create materialized view log on ab_mv with rowid
      2  /
    Gematerialiseerde viewlog is aangemaakt.
    SQL> create materialized view abc_mv
      2    refresh fast on commit
      3  as
      4  select ab.rowid ab_rowid
      5       , c.rowid  c_rowid
      6       , ab.a_id  a_id
      7       , ab.b_id  b_id
      8       , ab.a_col a_col
      9       , ab.b_col b_col
    10       , c.col    c_col
    11    from ab_mv ab
    12       , c
    13   where ab.a_id = c.a_id (+)
    14     and ab.b_id = c.b_id (+)
    15  /
    Gematerialiseerde view is aangemaakt.And to show that this works:
    SQL> select * from abc_mv
      2  /
    AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
    AAGpZ4AAQAAAS2sAAA                        1     1 name 1 name 1
    AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c2
    AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
    3 rijen zijn geselecteerd.
    SQL> update c set col = 'name c9' where a_id = 2
      2  /
    1 rij is bijgewerkt.
    SQL> commit
      2  /
    Commit is voltooid.
    SQL> select * from abc_mv
      2  /
    AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
    AAGpZ4AAQAAAS2sAAA                        1     1 name 1 name 1
    AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c9
    AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
    3 rijen zijn geselecteerd.
    SQL> insert into c values (1, 1, 'bla')
      2  /
    1 rij is aangemaakt.
    SQL> commit
      2  /
    Commit is voltooid.
    SQL> select * from abc_mv
      2  /
    AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
    AAGpZ4AAQAAAS2sAAA AAGpZxAAQAAAMrVAAA     1     1 name 1 name 1 bla
    AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c9
    AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
    3 rijen zijn geselecteerd.Regards,
    Rob.

  • I am unable to open documents ending with .doc (rather than docx, which I can open). The error message states "[name of document]" is being used by "another user." Do you want to make a copy? Help!!!

    How can I open a Word document, when I receive this error message "[name of document]" is being used by "another user." Do you want to make a copy?
    (This only occurs on the documents I have saved as .doc; the ones saved as "docx" open for me. Help!

    Did you recently reinstall the OS then copy all your files back over? Do a Get info on one of the documents and see if your current UserName is listed and has Read & Write permissions. If not select the Documents folder and check that for Read & Write permissions for your UserName. If it doesn't have R & W permissions Add it so it does.

  • How to performance tune this query

    I need some inputs on how to do performance tuning on this query to improve performance.
    It takes around 45 secs to run. Is it possible to make any improvements in this by putting hints or writing in another way?
    select count(*)
    as nCount from A ,
    B ,
    C
    WHERE A.COL1 = B.COL1 AND
    A.COl2 <> 'COM' AND
    B.COL2 = C.COL1 AND
    B.COl3 IS NULL AND
    B.COL4 = 'TEST'
    This is the query plan:
    Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE 1 51
    SORT AGGREGATE 1 37
    HASH JOIN 48 K 1 M 51
    TABLE ACCESS FULL A 68 K 998 K 32
    NESTED LOOPS 98 K 2 M 5
    TABLE ACCESS BY INDEX ROWID B 142 K 2 M 4
    INDEX SKIP SCAN XIF37B 142 K 6
    INDEX UNIQUE SCAN XPKC 1 5

    Mcka
    As well as EXPLAIN PLAN, let us know what proportion of rows are visited by this query. It may be that it is not using a full table scan when it should (or vice versa).
    And of course we'd need to know what indexes are available, and how selective they are for the predicated you have in this query ...
    Regards Nigel

  • Please show this query, data not showing why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO
    there is no any error and msg header and footer print.

    Maybe , the query in "NOT IN" clause select export_order1.orderno from export_order1
    return the same rows as the following portion return....
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    OR
    there are no rows which conform to the joining condition between the two tables BUYER and MERCH_ORDER ....
    Regards,
    Simon

  • Need pointers to improve performance of a select query to table vbrk

    Hey Folks,
    I have a query , whose performance needs to be tuned , as such:
        SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
         WHERE b~vgbel = gi_sales_items-vbeln
           AND b~vgpos  = gi_sales_items-posnr
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    where
    gi_sales_items is an internal table consisting of 278 entries,.
    The result set collected in table gi_billing_items is 200 records
    The total execution time for this query for the afore given data is 72,983 ms with the average time/record being ~ 9,471 ms which is too high.
    When I try to verify the Explain Plan of the query in ST05, in the Access path I see that the performance of Query Block 1 is bad. Query Block 1 is of the QBLOCK_TYPE UNIONA. Its the very first step in the Query execution internally.
    The indexes are defined on participating tables VBRK and VBRP as:
    VBRK~0      MANDT,VBELN
    VBRK~LOC MANDT,LCNUM
    VBRP~0      MANDT,VBELN,POSNR
    VBRP~Z01   FPLNR,MANDT
    VBRP~Z02   MANDT,MATNR,WERKS
    Its clear from the ST05, STAD and SE30 traces that there is a performance issue in this query. Does anyone have any pointers as to how to resolve this issue? Is there a protocol one needs to follow when using the "FOR ALL ENTRIES IN" clause? Or is there a need for any secondary indexes to be created?
    Please let me know
    Thanks and Best Regards,
    Rashmi.

    Hi,
    Try using the VBFA...to get the Invoice number and line item..and then use that value in VBRK...
    * Declare the internal table for T_VBFA.
    IF NOT gi_sales_items[] IS INITIAL.
    SELECT VBELV
                  POSNV
                  VBELN
                  POSNN
                  VBTYP_N
                  INTO TABLE T_VBFA
                  FOR ALL ENTRIES IN gi_sales_items
                  WHERE VBELV = gi_sales_items-VBELN
                  AND       POSNV = gi_sales_items-POSNR
                  AND       VBTYP_N = 'M'.             "Invoice                       ""Added this..
    ENDIF.
    **Add two columns to GI_SALES_ITEMS..to store the VBELN POSNN the data from t_vbfa..let's assume it is VBELN_VF and POSNR_VF
    * Basically merge gi_sales_items AND t_vbfa
    ** Then use that field in
    IF NOT GI_SALES_ITEMS[] IS INITIAL.
          SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
          WHERE b~vbeln = gi_sales_items-vbeln_vf   " Change here
           AND b~posnr  = gi_sales_items-posnr_vf     " Change here
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    ENDIF.
    Thanks
    Naren
    Edited by: Narendran Muthukumaran on Oct 15, 2008 11:35 PM

  • Please see this query, not showing data Why?

    I created a report and write following query,it was working well since last 4 months but today automaticly not showing data I can undertstand why?
    Becuase I didnt make any changes in this query.
    Please help me
    Urgent
    SELECT ALL MERCH_ORDER.ORDERNO, MERCH_ORDER.ORDERDATE, MERCH_ORDER.SHIP_DATE, MERCH_ORDER.PONO,
    MERCH_ORDER.SUBPP, MERCH_ORDER.PJNO, BUYER.B_NAME, BUYER.B_AJENT,
    MERCH_ORDER.ITEM, MERCH_ORDER.FABRIC, MERCH_ORDER.QUALITY, MERCH_ORDER.COMPOSITION,
    MERCH_ORDER.P_SIZE, MERCH_ORDER.QUANTITY, MERCH_ORDER.Q_UNIT,
    MERCH_ORDER.NETWHT, MERCH_ORDER.WT_UNIT, MERCH_ORDER.TERM, MERCH_ORDER.COMM,
    MERCH_ORDER.PRICE, MERCH_ORDER.CUR_SYMB, MERCH_ORDER.STATUS, MERCH_ORDER.REMARKS,
    MERCH_ORDER.WONO, MERCH_ORDER.PRONO, MERCH_ORDER.PES_QUANTITY,
    MERCH_ORDER.PES_Q_UNIT, MERCH_ORDER.PES_PRICE, MERCH_ORDER.PES_CUR_SYMB
    FROM BUYER, MERCH_ORDER
    WHERE MERCH_ORDER.CANCEL IS NULL
    AND (MERCH_ORDER.B_CODE = BUYER.B_CODE)
    and merch_order.orderno not in
    (select export_order1.orderno from export_order1)
    ORDER BY MERCH_ORDER.ORDERNO

    Where "first table" is merch_order and "second table" is export_order1?
    How many distinct orders are in each table?
    Are there any NULL order numbers in either table?
    I'd put money on the fact that if commenting out a clause causes a number of rows to be returned, that clause is filtering out all the rows. You'll need to go through your data to figure out why the NOT IN clause is filtering out all your rows.
    Justin

  • Alternative mathod for this query

    i wrote procedures
    one for getting data from source table to staging table. and
    seconed one is cross tab query to get data in target table format.
    can you help me make it more simple this query.
    thanks for your help in advance
    PROCEDURE repo_bk_proc is
    Begin
    --To Get all discrete Portfolios                           
    INSERT INTO repo_bk_staging
    (DATA_DT,
    REPO_BK_IND,
    PORTFOLIO,
    BUCKET,
    ACCT_CNT,
    PRIN_BAL)
    SELECT V_DATA_DT,
    CASE WHEN REPO_IND = ´N´ AND BKRPT_IND = ´N´ THEN ´01A_NONREPO_NONBK´
    WHEN REPO_IND = ´N´ AND BKRPT_IND = ´B´ THEN ´01B_NONREPO_BK´
    WHEN REPO_IND = ´R´ AND (STAT_SECND_1 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_2 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_3 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_4 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_5 IN (´B2´, ´B3´,´B7´,´BC´)) THEN ´02B_REPO_BK´
    WHEN REPO_IND = ´R´ AND BKRPT_IND = ´N´ THEN ´02A_REPO_NONBK´
    ELSE ´UNKNOWN´ END AS REPO_BK_IND,
    case
    when acct_num like ´110050000%´ then
    (case when LGL_ENT_CURR<=8999 then ´4´
    else ´10´ end)
    when acct_num like ´110050004%´ then
    (case when LGL_ENT_CURR<=8999 then ´2´
    else ´8´ end)
    when acct_num like ´110050006%´ then
    (case when LGL_ENT_CURR<=8999 then ´5´
    else ´11´ end)
    when acct_num like ´110050008%´ then
    (case when LGL_ENT_CURR<=8999 then ´1´
    else ´7´ end)
    ELSE ´ALL_0´ END AS PORTFOLIO,
    CASE WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,1),´mm´)-1 THEN ´00_CURRENT´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,0),´mm´)-1 THEN ´0_1_29´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-1),´mm´)-1 THEN ´1_30_59´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-2),´mm´)-1 THEN ´2_60_89´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-3),´mm´)-1 THEN ´3_90_119´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-4),´mm´)-1 THEN ´4_120_149´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-5),´mm´)-1 THEN ´5_150_179´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-6),´mm´)-1 THEN ´6_180_209´
    ELSE ´7_210_PLUS´ END AS BUCKET,
    COUNT(*) AS ACCT_CNT, SUM(PRIN_BAL) AS PRIN_BAL
    FROM AUTOR2.DLQ_RPT WHERE DATA_DT = trunc(v_data_Dt)
    GROUP BY
    CASE WHEN REPO_IND = ´N´ AND BKRPT_IND = ´N´ THEN ´01A_NONREPO_NONBK´
    WHEN REPO_IND = ´N´ AND BKRPT_IND = ´B´ THEN ´01B_NONREPO_BK´
    WHEN REPO_IND = ´R´ AND (STAT_SECND_1 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_2 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_3 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_4 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_5 IN (´B2´, ´B3´,´B7´,´BC´)) THEN ´02B_REPO_BK´
    WHEN REPO_IND = ´R´ AND BKRPT_IND = ´N´ THEN ´02A_REPO_NONBK´
    ELSE ´UNKNOWN´ END,
    case
    when acct_num like ´110050000%´ then
    (case when LGL_ENT_CURR<=8999 then ´4´
    else ´10´ end)
    when acct_num like ´110050004%´ then
    (case when LGL_ENT_CURR<=8999 then ´2´
    else ´8´ end)
    when acct_num like ´110050006%´ then
    (case when LGL_ENT_CURR<=8999 then ´5´
    else ´11´ end)
    when acct_num like ´110050008%´ then
    (case when LGL_ENT_CURR<=8999 then ´1´
    else ´7´ end)
    ELSE ´ALL_0´ END,
    CASE WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,1),´mm´)-1 THEN ´00_CURRENT´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,0),´mm´)-1 THEN ´0_1_29´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-1),´mm´)-1 THEN ´1_30_59´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-2),´mm´)-1 THEN ´2_60_89´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-3),´mm´)-1 THEN ´3_90_119´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-4),´mm´)-1 THEN ´4_120_149´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-5),´mm´)-1 THEN ´5_150_179´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-6),´mm´)-1 THEN ´6_180_209´
    ELSE ´7_210_PLUS´ END
    union
    -- To Get ALL portfolios total
    SELECT v_DATA_DT,
    CASE WHEN REPO_IND = ´N´ AND BKRPT_IND = ´N´ THEN ´01A_NONREPO_NONBK´
    WHEN REPO_IND = ´N´ AND BKRPT_IND = ´B´ THEN ´01B_NONREPO_BK´
    WHEN REPO_IND = ´R´ AND (STAT_SECND_1 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_2 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_3 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_4 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_5 IN (´B2´, ´B3´,´B7´,´BC´)) THEN ´02B_REPO_BK´
    WHEN REPO_IND = ´R´ AND BKRPT_IND = ´N´ THEN ´02A_REPO_NONBK´
    ELSE ´UNKNOWN´ END AS REPO_BK_IND,
    case when LGL_ENT_CURR<=8999 then ´01_ALL´
    else ´01_ALL_CO´ end AS PORTFOLIO,
    CASE WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,1),´mm´)-1 THEN ´00_CURRENT´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,0),´mm´)-1 THEN ´0_1_29´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-1),´mm´)-1 THEN ´1_30_59´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-2),´mm´)-1 THEN ´2_60_89´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-3),´mm´)-1 THEN ´3_90_119´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-4),´mm´)-1 THEN ´4_120_149´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-5),´mm´)-1 THEN ´5_150_179´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-6),´mm´)-1 THEN ´6_180_209´
    ELSE ´7_210_PLUS´ END AS BUCKET,
    COUNT(*) AS ACCT_CNT, SUM(PRIN_BAL) AS PRIN_BAL
    FROM AUTOR2.DLQ_RPT WHERE DATA_DT = trunc(v_data_Dt)
    GROUP BY
    CASE WHEN REPO_IND = ´N´ AND BKRPT_IND = ´N´ THEN ´01A_NONREPO_NONBK´
    WHEN REPO_IND = ´N´ AND BKRPT_IND = ´B´ THEN ´01B_NONREPO_BK´
    WHEN REPO_IND = ´R´ AND (STAT_SECND_1 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_2 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_3 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_4 IN (´B2´, ´B3´,´B7´,´BC´)
    OR STAT_SECND_5 IN (´B2´, ´B3´,´B7´,´BC´)) THEN ´02B_REPO_BK´
    WHEN REPO_IND = ´R´ AND BKRPT_IND = ´N´ THEN ´02A_REPO_NONBK´
    ELSE ´UNKNOWN´ END,
    case when LGL_ENT_CURR<=8999 then ´01_ALL´
    else ´01_ALL_CO´ end,
    CASE WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,1),´mm´)-1 THEN ´00_CURRENT´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,0),´mm´)-1 THEN ´0_1_29´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-1),´mm´)-1 THEN ´1_30_59´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-2),´mm´)-1 THEN ´2_60_89´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-3),´mm´)-1 THEN ´3_90_119´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-4),´mm´)-1 THEN ´4_120_149´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-5),´mm´)-1 THEN ´5_150_179´
    WHEN CONT_DATE > trunc(add_months(v_data_Dt+1,-6),´mm´)-1 THEN ´6_180_209´
    ELSE ´7_210_PLUS´ END
    ORDER BY REPO_BK_IND, BUCKET,PORTFOLIO;
    COMMIT;
    End repo_bk_proc;
    PROCEDURE repo_bk_rpt_proc is
    Begin
    INSERT INTO REPO_BK_RPT (
    DATA_DATE,PORTFOLIO,REPO_BK_IND,CURRENT_PRIN_BAL,CURRENT_ACCT_CNT,ONE_MTH_PRIN_BAL,ONE_MTH_ACCT_CNT,
    TWO_MTH_PRIN_BAL,TWO_MTH_ACCT_CNT,THR_MTH_PRIN_BAL,THR_MTH_ACCT_CNT,FOUR_MTH_PRIN_BAL,FOUR_MTH_ACCT_CNT,
    FIVE_MTH_PRIN_BAL,FIVE_MTH_ACCT_CNT,SIX_MTH_PRIN_BAL,SIX_MTH_ACCT_CNT,SEVE_MTH_PRIN_BAL,SEVE_MTH_ACCT_CNT,
    SEVE_MTH_PLUS_PRIN_BAL,SEVE_MTH_PLUS_ACCT_CNT)
    values
    SELECT A.DATA_DT, A.PORTFOLIO, A.REPO_BK_IND,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´00_CURRENT´),0))/1000 AS CURRENT_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´00_CURRENT´),0) AS CURRENT_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´0_1_29´),0))/1000 AS ONE_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´0_1_29´),0) AS ONE_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´1_30_59´),0))/1000 AS TWO_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´1_30_59´),0) AS TWO_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´2_60_89´),0))/1000 AS THR_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´2_60_89´),0) AS THR_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´3_90_119´),0))/1000 AS FOUR_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´3_90_119´),0) AS FOUR_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´4_120_149´),0))/1000 AS FIVE_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´4_120_149´),0) AS FIVE_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´5_150_179´),0))/1000 AS SIX_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´5_150_179´),0) AS SIX_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´6_180_209´),0))/1000 AS SEVE_MTH_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´6_180_209´),0) AS SEVE_MTH_ACCT_CNT,
    (NVL((SELECT B.PRIN_BAL FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´7_210_PLUS´),0))/1000 AS SEVE_MTH_PLUS_PRIN_BAL,
    NVL((SELECT B.ACCT_CNT FROM REPO_BK_STAGING B WHERE A.PORTFOLIO = B.PORTFOLIO
    AND A.REPO_BK_IND =B.REPO_BK_IND AND B.BUCKET = ´7_210_PLUS´),0) AS SEVE_MTH_PLUS_ACCT_CNT
    FROM REPO_BK_STAGING A
    GROUP BY DATA_DT, PORTFOLIO, REPO_BK_IND
    ORDER BY PORTFOLIO,REPO_BK_IND;
    COMMIT;
    End repo_bk_rpt_proc;

    can you help me make it more simple this query.Not really sure what you're expecting us to do. If those are your business rules those are your business rules. You might be able to make it slightly more readable by putting the basic selects in an inner view and putting the aggregating calls in an outer view but then you would have to distinguish between the "discrete portfolios" and "all portfolios" queries.
    Which leads me to a question? Do you know why you are using UNION rather than UNION ALL? Because UNION does an additional sort and may produce a different set of data than running either with UNION ALL or two separate queries.
    Cheers, APC

  • "This device can perform faster...." - but can it really?

    Ok, seems like my iPhone 3G does not really support USB 2.0. Every time I plug it in I get the "This device can perform faster..." message indicating that it is running in USB 1.1 mode - even though the port is USB2.0 and if I plug in a USB2.0 external drive into the same port it works like a charm (at full 2.0 speed).
    Give how unstable iPhone's been and how often it requires a full reload, USB1.1 speed is just too painful.
    Anyone else run into this? Any suggestions on how to make it run at full speed?
    Thanks.
    Message was edited by: Hichhiker

    Nathan C wrote:
    I have iPhone OS 2.0.2 on two different iPones and iTunes 7.7.1 on four different computers (mix of Mac and Windows-based PC) and not had an issue with apps or DRM, nor probably do the majority of users.
    I am happy it works for you, it worked for me too for a while... then after one sync suddenly my iPod was empty of all content and most of the apps would not run (yet some did - go figure). The funny thing is that most of the content on my iPod was DRM free MP3's - did not matter, they were all inaccessible).
    All in all, even if you are, I am not willing to play Russian roulette wondering with each sync if I will be forced to waste hours deleting and restoring my iPhone (and with USB2 broken, it takes hours and hours) and then re-set up all my email, etc - because those settings apparently are not important enough to be saved by a backup - and then deal with loosing app data. Even if majority of the people do not have this issue, enough people did, including myself.
    And by the way, when I was running 7.7.1, the USB problem was there just the same - so the only "solution" to it seems to be to sit and wait for apple to fix it.
    -HH

  • Hey I was on my computer and it wasn't starting up so I pressed command s and this code stuff showed up and said :/ root# It says "if you want to make modifications to files: /sbin/fsck -fy /sbin/mount -uw /

    It says "if you want to make modifications to files:
    /sbin/fsck -fy
    /sbin/mount -uw /

    Hello frankenstienfromab,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    Resolve startup issues and perform disk maintenance with Disk Utility and fsck
    http://support.apple.com/kb/ts1417
    If your computer won't start up normally, you may need to use a disk repair utility to fix the issue. Mac OS X includes two utilities for this—Disk Utility and fsck (a command-line utility).
    fsck is a command-line utility that may be able to verify and repair a disk.
    Best of luck,
    Mario

Maybe you are looking for