内部in子句中使用的varchar失败

时间:2016-05-11 17:44:56

标签: mysql

我有一个存储过程:

CREATE DEFINER=`root`@`localhost` PROCEDURE `spSetExtracted`(IN `reportDataIdList` VARCHAR(1124))
    LANGUAGE SQL
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
BEGIN
    UPDATE
        reportdata
    SET
        Extracted=1
    WHERE
        ReportDataId in ( reportDataIdList )
    ;
END

失败了这个错误:

Truncated incorrect DOUBLE value: '1387182,1387162,1387287,1387427,1387212,1387252,1387257'

正如你所看到的,上面的id列表是一个varchar,我希望为每个id设置提取的标志。

我还需要对reportDataIdList做些什么吗?

这是表定义: CREATE TABLE reportdata(     ReportDataId BIGINT(20)NOT NULL AUTO_INCREMENT,     ReportFieldId INT(11)NOT NULL,     CompanyId INT(11)NOT NULL,     DataDate DATE NOT NULL,     ReportDataItem VARCHAR(50)NOT NULL,     Extracted TINYINT(1)NOT NULL DEFAULT' 0',     PRIMARY KEY(ReportDataId),     INDEX FK_ReportData_ReportFieldReportFieldId),     INDEX FK_ReportData_SymbolCompanyId),     CONSTRAINT FK_ReportData_ReportField FOREIGN KEY(ReportFieldId)引用reportfieldReportFieldId)ON更新无操作删除无操作 ) COLLATE =' utf8_general_ci'

0 个答案:

没有答案