@temp变量有什么问题?
display: block
答案 0 :(得分:2)
使用select
调用标量函数
正确的方法是
select @temp = dbo.getNumOfReviews2(BillingEmail)
from dbo.Orders
where OrderID=@OrderID
注意:不建议在触发器内写入大逻辑。触发器应该简单快速,否则DML操作会很慢。此外,您使用了CURSOR
,应该不惜一切代价避免使用;WITH cte
AS (SELECT c1.orderid
FROM dbo.[contains] c1
INNER JOIN inserted i1
ON i1.orderid = c1.orderid
GROUP BY orderid
HAVING Count(*) > 5
OR Sum(quantity) > 5
OR @temp > 5)
UPDATE C
SET [savings%] = [savings%] + 0.05
FROM [contains] C
INNER JOIN inserted I
ON I.orderid = C.orderid
AND I.productid = C.productid
AND I.size = C.size
AND EXISTS (SELECT 1
FROM cte c1
WHERE c1.orderid = c.orderid)
。使用基于SET的方法重写代码。
以下是基于SET的方法代码
$(document).on("mouseenter","#lsTMFmenu", function() {
答案 1 :(得分:0)
CREATE OR REPLACE COVID19VMS_VACCINESHOT_T1
BEFORE INSERT OR UPDATE ON VACCINENEXTSHOTDATE
FOR EACH ROW
BEGIN
IF :NEW.VACCINESHOTDATE := 1
:NEW.VACCINEXTSHOTDATE := to_date(VACCINESHOTDATE +28)
END IF;
IF :NEW.VACCINESHOTDATE :=2
:NEW.VACCINENEXTSHOTDATE IS NULL
END IF
END