请检查为什么此代码不断更新表中的所有行
UPDATE FINANCE_ORDERS
SET ORDER_STATUS = 'NOT APPROVED EWW'
WHERE
ORDER_DATE = '&TIME_1'
AND
((&V5)*(&V6)) < (&V7)
OR
((&V5)*(&V6)) - (&V7) < (&V3)
OR
(&V3) < (&V8)
OR
(&V3) > (&V9)
/
SQL> /
Enter value for time_1: 12-14-2018 05:53:43
old 4: ORDER_DATE = '&TIME_1'
new 4: ORDER_DATE = '12-14-2018 05:53:43'
Enter value for v5: 15
Enter value for v6: 15000
Enter value for v7: 175000
old 6: ((&V5)*(&V6)) < (&V7)
new 6: ((15)*(15000)) < (175000)
Enter value for v5: 15
Enter value for v6: 15000
Enter value for v7: 175000
Enter value for v3: 1500
old 8: ((&V5)*(&V6)) - (&V7) < (&V3)
new 8: ((15)*(15000)) - (175000) < (1500)
Enter value for v3: 1500
Enter value for v8: 2000
old 10: (&V3) < (&V8)
new 10: (1500) < (2000)
Enter value for v3: 1500
Enter value for v9: 180000
old 12: (&V3) > (&V9)
new 12: (1500) > (180000)
3 rows updated.
上面的代码应该只为那些具有相同日期和时间 (varchar2) 的行更新订单状态,例如 (12-14-2018 05:53:43),
代码在前三个条件之间运行良好,直到我意识到我做了太多的“或”关系。
任何建议我如何修复此代码以满足我所做的所有条件?:)