--todo 21126
/*
update stockquantity sq
   set sq.qtyunique                 =
       (select count(ui.uniqueitem_id)
          from uniqueitemfixedinfo      uifi,
               uniqueitem               ui,
               stockdefinitionperitem   sdi,
               stockroomlocation        srl,
               stockreservationpergrade srpg
         where uifi.uniqueitem_id = ui.uniqueitem_id
           and uifi.stockroomlocation_id = sq.stockroomlocation_id
           and ui.product_id = sdi.product_id
           and ui.sizedefinition_id = sdi.sizedefinition_id
           and srl.stockroom_id = sdi.stockroom_id
           and (ui.relatedcustomer_id = sdi.customer_id or
               (nvl(ui.relatedcustomer_id, 0) = 0 and
               nvl(sdi.customer_id, 0) = 0))
           and srpg.stockdefinitionperitem_id =
               sdi.stockdefinitionperitem_id
           and srpg.qualitygrade_id = uifi.qualitygrade_id
           and sdi.customerowned = ui.customerowned
           and sq.stockreservationpergrade_id =
               srpg.stockreservationpergrade_id
           and sq.stockroomlocation_id = srl.stockroomlocation_id
           and not exists
         (select 1
                  from uniqueitemmodification um, modification m
                 where um.uniqueitem_id = ui.uniqueitem_id
                   and um.modification_id = m.modification_id
                   and m.stockwithstandardsize = 'N')),
       sq.qtyuniquewithmodifications =
       (select count(ui.uniqueitem_id)
          from uniqueitemfixedinfo      uifi,
               uniqueitem               ui,
               stockdefinitionperitem   sdi,
               stockroomlocation        srl,
               stockreservationpergrade srpg
         where uifi.uniqueitem_id = ui.uniqueitem_id
           and uifi.stockroomlocation_id = sq.stockroomlocation_id
           and ui.product_id = sdi.product_id
           and ui.sizedefinition_id = sdi.sizedefinition_id
           and srl.stockroom_id = sdi.stockroom_id
           and (ui.relatedcustomer_id = sdi.customer_id or
               (nvl(ui.relatedcustomer_id, 0) = 0 and
               nvl(sdi.customer_id, 0) = 0))
           and srpg.stockdefinitionperitem_id =
               sdi.stockdefinitionperitem_id
           and srpg.qualitygrade_id = uifi.qualitygrade_id
           and sdi.customerowned = ui.customerowned
           and sq.stockreservationpergrade_id =
               srpg.stockreservationpergrade_id
           and sq.stockroomlocation_id = srl.stockroomlocation_id
           and exists (select 1
                  from uniqueitemmodification um, modification m
                 where um.uniqueitem_id = ui.uniqueitem_id
                   and um.modification_id = m.modification_id
                   and m.stockwithstandardsize = 'N'));

commit;
*/