您不能在参数之间使用引号,不确定您是否添加引号只是为了格式化您的任务或实际将其添加到您的参数中。
我编写了一个简单的节点红色流程function node
来构建查询及其dashDB node
本身。
在我的function node
我有以下查询:
msg.fromDate = '2011-04-12 00:00:00';
msg.toDate= '2015-03-12 00:00:00';
msg.payload = "SELECT COL2 FROM DASH104951.TESTDATE WHERE START >= ? AND END <= ?";
return msg;
在dashDB node
我只有参数标记文本字段:
msg.fromDate,msg.toDate
一切正常。
这是我的 node-red 流程,如果您想将其导入您自己的 node-red 应用程序:
[{"id":"211a834b.dee57c","type":"inject","z":"197f318.fe680ce","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":117,"y":115,"wires":[["7a23c994.85dc38"]]},{"id":"7a23c994.85dc38","type":"function","z":"197f318.fe680ce","name":"Build Query","func":"msg.fromDate = '2011-04-12 00:00:00';\nmsg.toDate= '2015-03-12 00:00:00';\nmsg.payload = \"SELECT COL2 FROM DASH104951.TESTDATE WHERE START >= ? AND END <= ?\";\nreturn msg;","outputs":1,"noerr":0,"x":325,"y":123,"wires":[["559c92e4.aa636c"]]},{"id":"24974090.db68c","type":"debug","z":"197f318.fe680ce","name":"dashDB query result","active":true,"console":"false","complete":"true","x":773,"y":125,"wires":[]},{"id":"559c92e4.aa636c","type":"dashDB in","z":"197f318.fe680ce","service":"dashDB-0a","query":"","params":"msg.fromDate,msg.toDate","name":"","x":548,"y":131,"wires":[["24974090.db68c"]]}]