I have the following query that I used in the procedure and I want to convert one number to positive, since now it is negative.
UPDATE SHIPMENT
SET TOTAL_SHIP_UNIT_COUNT = (
CASE
WHEN V_SHIP_UNIT_COUNT > v_diff_cost
THEN V_SHIP_UNIT_COUNT - v_diff_cost
ELSE v_diff_cost - V_SHIP_UNIT_COUNT
END)
WHERE SHIPMENT_GID = v_shipment_id;
COMMIT;
in this query, the value of v_diff_cost is negative, so when the action ( V_SHIP_UNIT_COUNT - v_diff_cost)is performed, it adds both values, therefore, if I convert the value v_diff_costto positive, then subtraction will give me the correct result.
Suppose that the value V_SHIP_UNIT_COUNTis 33, and v_diff_cost value-10, then in this case it should perform the action as 33-10 = 23, but it is executed as 33-(-10)= 43, and this should not be.
kindly help me. Thanks
source
share