DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: SQL Tunning

Threaded View

  1. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    Do you really need the UPPER functions? Try it without the UPPER functions and see if it still works. i.e. Do you really have mixed case values? You used a decode where a NVL should work at the beggining.

    Code:
    SELECT sap_inv.plant, sap_inv.matnr,
           DECODE( sap_inv.batch, 'NOBATCHNO', '', sap_inv.batch ),
           sap_inv.sloc,
           sap_inv.sap_qty, user_inv.user_qty,
           sap_inv.sap_qty - user_inv.user_qty qty_diff
    FROM   ( SELECT  UPPER( plant ) plant, UPPER( matnr ) matnr,
                     UPPER( NVL( batch, 'NOBATCHNO' )) batch, 
                     UPPER( sloc ) sloc,
                     SUM( book_qty ) sap_qty
            FROM     pi_sloc_sap_inv
            GROUP BY UPPER( plant ),
                     UPPER( matnr ),
                     UPPER( NVL( batch, 'NOBATCHNO' )),
                     UPPER( sloc )) sap_inv,
           ( SELECT  UPPER( matnr ) matnr, 
                     UPPER( NVL( batch, 'NOBATCHNO' )) batch,
                     UPPER( sloc ) sloc, SUM( count_qty ) user_qty
            FROM     pi_sloc_user_inv
            GROUP BY UPPER( matnr ),
                     UPPER( NVL( batch, 'NOBATCHNO' )),
                     UPPER( sloc )) user_inv
    WHERE  sap_inv.matnr = user_inv.matnr AND
           sap_inv.batch = user_inv.batch AND
           sap_inv.sloc = user_inv.sloc;
    Last edited by gandolf989; 08-16-2004 at 09:14 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width