I am using Oracle's Node js driver. I know how to bind simple variables in an SQL statement but how do you bind a variable that uses an IN clause?
In the example below, my bind variable is :grp_ids and I want to bind it to an array of strings. But the code does not produce the expected result.
function test2()
{
oracledb.getConnection(connInfo,
function(err, connection)
{
if (err) {console.error(err.message); return; }
var grpIds = '(\'0021\', \'1684\')';
console.log(grpIds);
connection.execute(`
SELECT ag.grp_id, ag.grp_nm from acct_group ag
WHERE ag.grp_id in :grp_ids`,
{grp_ids: grpIds},
function(err, result)
{
if (err) {console.error(err.message); return; }
console.log(result.rows);
});
});
}