Thursday, 17 July 2014

Order Hold Information Query

/* Formatted on 7/17/2014 12:38:29 PM (QP5 v5.115.810.9015) */
SELECT  /*+ use_nl (ooh hld ohs ohd ohr) */
      ooh.order_number "Order Number",
       ooh.ordered_date "Ordered Date",
       ooh.flow_status_code "Order Status",
       ooh.credit_card_approval_code "Credit Card Approval Code",
       ohd.name "Hold Name",
       ohs.released_flag "Hold Release Flag",
       ohr.release_reason_code "Hold Release Reason",
       ohr.creation_date "Hold Release Date",
       ooh.payment_type_code "Payment Type Code"
FROM apps.oe_order_headers_all ooh,
     apps.oe_order_holds_all hld,
     apps.oe_hold_sources_all ohs,
     apps.oe_hold_definitions ohd,
     apps.oe_hold_releases ohr
WHERE ooh.ordered_date BETWEEN :From_Dete to :TO_Daye
      AND ooh.order_category_code = 'ORDER'
      AND hld.header_id(+) = ooh.header_id
      AND ohs.hold_source_id(+) = hld.hold_source_id
      AND ohd.hold_id(+) = ohs.hold_id
      AND ohr.hold_release_id(+) = ohs.hold_release_id
ORDER BY ooh.order_number

1 comment:

  1. The cost of the query is very high if given date criteria??

    ReplyDelete