begin
  update GK_TR_OB
     set TYPE_DOC_TR = (select S_CLASS from RKO_VP where DOC_OID = 1006744 and DOC_ID = GK_TR_OB.ID)
     where S_S=1002803 and ISP_NO_DOC = 0 and TYPE_DOC_TR is null and TYPE_DOC_OB is null and nvl(REMARK,' ')<>'*CONVERT*'
  and VIEW_ON=1 and nvl(CLS_DOCOID,0) <> 1006862 and ISP_AUTO is null
  and TYP = 1
  and exists(select ID from RKO_VP where DOC_OID = 1006744 and DOC_ID = GK_TR_OB.ID);
  
  
  update GK_TR_OB
     set TYPE_DOC_OB = (select S_CLASS from RKO_VP where DOC_OID = 1006744 and DOC_ID = GK_TR_OB.ID)
     where S_S=1002803 and ISP_NO_DOC = 0 and TYPE_DOC_TR is null and TYPE_DOC_OB is null and nvl(REMARK,' ')<>'*CONVERT*'
  and VIEW_ON=1 and nvl(CLS_DOCOID,0) <> 1006862 and ISP_AUTO is null
  and TYP = 2
  and exists(select ID from RKO_VP where DOC_OID = 1006744 and DOC_ID = GK_TR_OB.ID);
end;

