Determine order number from delivery_detail_id in Oracle Apps 11i

I recently needed to look up the order number associated with a delivery_detail_id, so that I could run diagnostics on the sales order. ┬áHere’s a quick script that I whipped up to find the info:

select
  unique wdd.source_header_number order_number,
  wdd.source_header_id,
  wdd.source_header_type_name order_type,
  wdd.source_line_id line_id,
  msi.segment1 item
from
  wsh_delivery_details wdd,
  mtl_system_items_b msi
where
  wdd.delivery_detail_id in (
    123456,
    789012,
    345678,
    901234) and
  msi.inventory_item_id = wdd.inventory_item_id