语法错误@在表触发器中输出new.value

时间:2012-04-10 10:26:11

标签: mysql triggers syntax-error

有任何问题:

DELIMITER ;;
CREATE TRIGGER `UPD_after_financialStatus` AFTER UPDATE ON `financialStatus` 
FOR EACH ROW
BEGIN
DECLARE `@grossAmountTillNow` varchar(100);
SET @grossAmountTillNow = CONCAT(
    CAST(OLD.grossAmountTillNow AS varchar(50)),
    "---",
    CAST(NEW.grossAmountTillNow AS varchar(50)));
...

它说Syntax error near 'varchar(50)),"---",CAST(NEW.grossAmountTillNow AS varchar(50))); SET @grossAmoun' at line 4 你能帮忙吗?

1 个答案:

答案 0 :(得分:1)

请比较:

SELECT CAST(CURRENT_TIMESTAMP AS VARCHAR(50))
  

您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第1行“VARCHAR(50)”附近使用正确的语法

SELECT CAST(CURRENT_TIMESTAMP AS CHAR(50))
  

2012-04-10 12:30:29

允许的值在Cast Functions and Operators解释。