update list A
The original SQL
UPDATE A
The SET rate='1'
WHERE id=v_task_id
AND trunc (valid_date) & gt; Trunc (p_create_date);
UPDATE A
The SET rate=round ((trunc (end_date) - trunc (p_create_date))/
(trunc (end_date) - trunc (the start_date) + 1),
6)
WHERE id=v_task_id
AND trunc (valid_date) & lt;=trunc (p_create_date)
AND trunc (end_date) - trunc (the start_date) + 1 & lt;> 0;
UPDATE A
The SET upr=round (upr_rate * prem, 6)
WHERE id=v_task_id;
Or
UPDATE A
The set rate=(case rate the when? Then? else? The end),
Upr=? ,
WHERE id=v_task_id;
Which way is good, what is the critical condition, or test so
CodePudding user response:
It depends on what your demand is decided to use which statement updateCodePudding user response:
First, in our business, description is simple, is also very clear,The second, a big table to do this operation, if it is exclusive, only scan a table, on the performance or have an advantage, but if is an OLTP system, there will be competition,
Suggest the first kind,