1

有什么问题吗 :

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
你能帮忙吗?

4

1 回答 1

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中解释了允许的值。

于 2012-04-10T10:35:28.297 回答