错误:ER_BAD_FIELD_ERROR:“字段列表”中的未知列'claimSystemId'

时间:2018-05-17 08:48:40

标签: mysql node.js amazon-rds-aurora

我们在mysql中使用Node.Js包来连接Aurora数据库。

我们正在调用存储过程,有时会出现Error: ER_BAD_FIELD_ERROR: Unknown column 'claimSystemId' in 'field list'错误。

CREATE DEFINER=`CLIroham`@`%` PROCEDURE `spGetMasterData`(IN documentIdParam bigint)
BEGIN
select stateId AS id,stateName AS  name  from  state;
select countryId AS id, countryName  AS  name  from  country;
select statusCode AS id, status AS name from  statusMaster where type_of_status = 'Client_Instruction_Status';
select statusCode AS id, status AS name from  statusMaster where type_of_status = 'PROGRAM_STATUS';
select personId AS id, firstname AS name  from person where employeeType = 'AE' limit 20;
select naicsCodeId AS id, naicsCode as name   from  naicsMaster limit 20;
select clientId AS id , name AS name from client limit 10;
select doc.revNumber as revNumber ,concat(p.firstname,' ',p.lastname) as createdBy,
doc.lastModifiedDate as lastModifiedDate, doc.revChangesText 
from documentHistory as doc JOIN person as p on p.personId=doc.lastModifiedBy
where doc.documentId = documentIdParam
order by revNumber desc;
select claimSystemId As id, Name as name  from  claimSystem;
END

我们检查了我们的数据库,并且“claimSystemId”列存在。我们尝试在存储过程中定位不同的select语句,但每次错误都不常见且保持不变。

mysql连接细节如下:

exports.pool = mysql.createPool({
    connectionLimit: 100,
    host: "###",
    user: "##",
    password: "##",
    port: "3306",
    database: "##",
    multipleStatements: true
});

DB.pool.getConnection(function (err, connection) {
    if (!!err) {
        //console.error(err);
        res.status(500).send(err);
    } else {
        connection.query("call spGetMasterData(?)", _documentId, function (error, result) {
            if (error) {

                connection.release();
                var errorResponse = {
                    "errorMessage" : "Retry"
                }
                res.send(errorResponse)
                return
            }
            else {
                //.....
            }
        })
    }
})

1 个答案:

答案 0 :(得分:0)

我在这里不是100%,但是我相信当您传递值时,您需要确保使用${value}截断该值,如果要传递的值是否为a,字符串,那么您将需要'${string_value}',看起来像是'_documentId,但是看起来错误与您的connection.query();