ID; $sql = "UPDATE YTYCUSTOM.XX_YTY_INCOMING_OUTGOING_INSPECTION_SHIP_HD SET STATUS = 'R', MODIFIED_BY = :MODIFIED_BY, MODIFIED_DATE = SYSDATE WHERE ID = :SHIP_ID"; $sqlarr = oci_parse($dbcon , $sql); oci_bind_by_name($sqlarr, ':MODIFIED_BY', $data->USERID); oci_bind_by_name($sqlarr, ':SHIP_ID', $newid); $r = oci_execute($sqlarr, OCI_NO_AUTO_COMMIT); if (!$r) { $e = oci_error($sqlarr); $errorMsg = json_encode($e['message']); goto finalStep; } //Empty the rack $sql_det = " UPDATE ytycustom.gth_rack_master SET occupied = NULL, ref_no = NULL, customer = NULL, brand = NULL, size_code = NULL, quantity = NULL, irrd = NULL, serial_no = NULL WHERE rack_code IN (SELECT b.racking_no FROM ytycustom.xx_yty_incoming_outgoing_inspection_detail_stl_part a, ytycustom.xx_yty_incoming_outgoing_inspection_detail_stl b WHERE a.stl_id = b.id AND a.ship_id = :ship_id AND b.outgoing_qty = b.quantity_of_cartons)"; $sqlarr_det = oci_parse($dbcon , $sql_det); oci_bind_by_name($sqlarr_det, ':ship_id', $newid); $r = oci_execute($sqlarr_det, OCI_NO_AUTO_COMMIT); if (!$r) { $e = oci_error($sqlarr_det); $errorMsg = json_encode($e['message']); goto finalStep; } finalStep: $result = []; if ($errorMsg == "") { oci_commit($dbcon); $result[] = [ "message" => "Success", "id" => $newid ]; } else { oci_rollback($dbcon); $result[] = [ "message" => $errorMsg, "id" => "" ]; } print json_encode($result); ?>