以下是我创建代码的代码,如下所示。
CREATE or REPLACE TRIGGER sms_trigger
AFTER INSERT ON student
FOR EACH ROW
ENABLE
DECLARE lclcmd CHAR(255);
DECLARE res VARCHAR(255);
BEGIN
SET lclcmd = CONCAT("php C:/xampp/htdocs/sample/sms_send.php");
SET res = sys_exec(lclcmd);
END;
运行上述代码后,出现如下错误
1) Error(1,5): PLS-00103: Encountered the symbol "DECLARE" when expecting
one
of the following: begin function pragma procedure subtype type <an
identifier> <a double-quoted delimited-identifier> current cursor delete
exists prior The symbol "begin" was substituted for "DECLARE" to continue.
2) Error(4,11): PLS-00103: Encountered the symbol "LCLCMD" when expecting
one of the following: transaction <a SQL statement>
答案 0 :(得分:1)
检查以下内容,请注意,您已在concat中添加了一个字符串..,concat函数是错误的。
请注意,您不必再使用一次声明,也不必添加,Case When DATEPART(MM,CT.TransactionDate) = DATEPART (MM,Dateadd(mm, -3, getdate())) and DATEPART(YY,CT.TransactionDate) = DATEPART (YY,Dateadd(mm, -3, getdate())) and ct.SalControlValueInBaseCurrency <> 0 Then ct.SalControlValueInBaseCurrency End AS [Month4+]
,并且在分配值时必须放置SET
。
:=