'Inserting values into sql node.js

I have this:

var userRegister2 = "INSERT INTO GOT (USERNAME, PASSWORD, NAME, USERID) VALUES (?)";
ibmdb.open(ibmdbconnMaster, function (err, conn) {
  if (err) return console.log(err);
  conn.query(userRegister2, [registerDetails.username, registerDetails.password, registerDetails.name, registerDetails.userid], function (err, rows) {
    if (err) {
      console.log(err);
    }

    console.log("success!")


    res.render('index.ejs')

    conn.close(function () {
    });
  });
});

all looks good to me, but then what happens is I get this error:

 SQL0117N  The number of values assigned is not the same as the number of specified or implied columns or variables.

In my database table, I have only those 4 columns, so I am not sure what else to do?



Solution 1:[1]

The solution is to change the code so that the number of parameter-markers matches the number of parameters.

In your case, that means VALUES (?,?,?,?) because you are supplying four parameters.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mao