Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Query Optimization

639485Oct 1 2008 — edited Oct 1 2008
Hi ,

I have written 2 queries as follows.But these queries are taking more time.
select count(OBJID) as counter  from oaminspectorshipments
      where ridkey = 'psi08' 
 AND OBJID IN 
    ( select PRESENTATION_ID from 
              INSPECTOR_SHIPMENTS_PROPOSALS where 
                PROPOSAL_ID = 
                   (  select agreement_id from oamInspectorPOs 
                         where  lower(PURCHASEORDER) = lower('tony-filter03') ) ) 
This query(1st ) will give the count.
SELECT A.* FROM (select RIDKEY,OBJID,shipment_number,
                               NAME as seller,amount as invoiceAmount,
                              Currency as invoiceCurrency,status,
                              insepction_result,lastdate,presentation_Date,
                              operationCode, PACKING_LIST_DOCID, 
                             COMMERCIAL_INVOICE_DOCID,version,last_msg_id, unread, 
                             INSPECTION_REPORT_DOCID, CREATIONDATE , 
                             row_number() over ( ORDER BY lastdate DESC) as rn 
                        FROM oaminspectorshipments where ridkey='psi08' AND 
                          OBJID IN 
                             ( select PRESENTATION_ID from 
                                    INSPECTOR_SHIPMENTS_PROPOSALS 
                                  where  PROPOSAL_ID = 
                                          (  select agreement_id from 
                                                 oamInspectorPOs 
                                              where lower(PURCHASEORDER) = lower('tony-filter03') ) )) A    
                         WHERE rn BETWEEN 1 and 0 
2nd query will display the result.
Please optimize these queries.

Thank you.

Edited by: user636482 on Sep 30, 2008 11:17 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2008
Added on Oct 1 2008
3 comments
195 views