我对 nodejs 中的 aws sdk 进行了以下查询,并在 aws lamdba 中运行,使用参数数组时该查询不起作用:
executeStatement({
Statement: `select * from "myTable"."myIndex" where "pk" = '?' and "sortKey5" >= 50 ORDER BY "sortKey5" DESC`,
Parameters: [{"S": pk}] })
使用参数直接内联的相同查询有效
executeStatement({
Statement: `select * from "myTable"."myIndex" where "pk" = 'xxx' and "sortKey5" >= 50 ORDER BY "sortKey5" DESC` })
这可能是'?'的语法 这是错误的,但我找不到任何具有其他语法的示例。
有谁知道如何编写语句以便它使用参数?