更新时间:2022-12-03 23:37:51
您对 CASE
语句进行编码的方式无效。事件逻辑需要在 SELECT
或 SET
中发生。您 , SET
位于中间, THEN
。
The way you have coded your CASE
statements will not work. Case logic needs to happen within a SELECT
, or SET
. Yours are just out there, and the SET
is in the middle, after the THEN
.
您需要将您的逻辑更改为类似于 CASE
的代码。 / p>
You will need to change your logic to something like this for each CASE
you have in your code.
IF @TranPrin = 0
SET @DelqPrin = 0
IF @TranPrin >0 AND @TranPrin > @DelqPrin
BEGIN
SET @TranPrin = @TranPrin - @DelqPrin
SET @ColPrin = @ColPrin + @DelqPrin
END
IF @TranPrin > 0 AND @TranPrin < @DelqPrin
BEGIN
SET @ColPrin = @ColPrin + @TranPrin
SET @TranPrin = 0
SET @DelqPrin = @DelqPrin -@TranPrin
END