SELECT col.CONTRACT Site,
       ip.TYPE_DESIGNATION "Product Group",
       col.ORDER_NO "Order No",
       TO_CHAR(col.REAL_SHIP_DATE, 'YYYY-MM-DD') "Real Ship Date",
       col.CATALOG_NO "Catalog No",
       slc.QTY_SHIPPED / NVL(slc.CONV_FACTOR, 1) *
       NVL(slc.INVERTED_CONV_FACTOR, 1) "Quantity Shipped",
       IPC.ATTR_VALUE_ALPHA "Decoration"

  FROM ifsapp.Customer_Order_line col
 INNER JOIN ifsapp.Inventory_Part ip
    ON ip.PART_NO = col.CATALOG_NO
   AND ip.CONTRACT = col.CONTRACT
 INNER JOIN ifsapp.Shipment_Line slc
    ON slc.SOURCE_REF1 = col.ORDER_NO
   AND slc.SOURCE_REF2 = col.LINE_NO
   AND slc.SOURCE_REF3 = col.REL_NO
  left join (Select contract, Part_No, ATTR_VALUE_ALPHA
               from Inventory_Part_Char_All
              where CHARACTERISTIC_CODE = '00034') IPC
    on IPC.Contract = IP.Contract
   and IPC.Part_No = IP.Part_No

 WHERE col.STATE <> 'Closed'
   AND col.CONTRACT = '&SITE'
   AND col.ORDER_NO LIKE NVL(LTRIM(RTRIM('&ORDER_NUMBER')), '%')
   AND col.REAL_SHIP_DATE BETWEEN TO_DATE('&DATE_FROM', 'YYYY-MM-DD') AND
       TO_DATE('&DATE_TO', 'YYYY-MM-DD')
   AND ROWNUM < 10001
