1392: unclosed. */
1393:
1394: SELECT count(*)
1395: INTO x_history_count
1396: FROM WIP_OP_YIELD_HISTORY
1397: WHERE wip_entity_id = rec_wip_entity.wip_entity_id
1398: AND organization_id = x_organization_id
1399: AND acct_period_id = rec_wip_entity.acct_period_id;
1400:
1400:
1401: IF (x_history_count = 0) THEN
1402:
1403: ---------------------------------------------------------
1404: -- INSERT INTO WIP_OP_YIELD_HISTORY --
1405: ---------------------------------------------------------
1406:
1407: INSERT INTO WIP_OP_YIELD_HISTORY
1408: (wip_entity_id,
1403: ---------------------------------------------------------
1404: -- INSERT INTO WIP_OP_YIELD_HISTORY --
1405: ---------------------------------------------------------
1406:
1407: INSERT INTO WIP_OP_YIELD_HISTORY
1408: (wip_entity_id,
1409: organization_id,
1410: acct_period_id,
1411: est_scrap_absorb_amt,
1438: sysdate);
1439: ELSE /* Row exists */
1440:
1441: ---------------------------------------------------------
1442: -- UPDATE WIP_OP_YIELD_HISTORY --
1443: ---------------------------------------------------------
1444:
1445: UPDATE WIP_OP_YIELD_HISTORY
1446: SET
1441: ---------------------------------------------------------
1442: -- UPDATE WIP_OP_YIELD_HISTORY --
1443: ---------------------------------------------------------
1444:
1445: UPDATE WIP_OP_YIELD_HISTORY
1446: SET
1447: est_scrap_absorb_amt = x_tl_scrap_in,
1448: est_scrap_reverse_amt = x_tl_scrap_out,
1449: est_scrap_var_amt = (x_scrap_variance + x_tl_scrap_var),