-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
- What versions are you using?
Node - v12.18.2
node-oracledb#v5.1.0
Give your database version.
oracle 11g
- Describe the problem
I have a problem trying to make an insert, compile error - Error: NJS-005: invalid value for parameter 2
- Include a runnable Node.js script that shows the problem.
const registerContato = async () => {
const options = {
autoCommit: true,
bindDefs: {
s: { type: oracledb.NUMBER },
p: { type: oracledb.NUMBER},
t: { type: oracledb.STRING, maxSize: 200 },
dt: { type: oracledb.DATE },
u: { type: oracledb.STRING, maxSize: 200 },
obs: { type: oracledb.STRING, maxSize: 200 },
con: { type: oracledb.STRING, maxSize: 200 },
loc: { type: oracledb.STRING, maxSize: 200 }
}
}
const binds =
{
s: 123456,
p: 1113567,
t: "FALTA",
dt: new Date(),
u: "KLEYTON",
obs: "TESTE",
con: "PACIENTE",
loc: "EXAMES"
};
const sql = `INSERT INTO dbamv.fav_registro_contato_marc(CD_SEQ, CD_PACIENTE, TP_SITUACAO, DT_REGISTRO, CD_USUARIO, DS_OBSERVACAO, CONTATO, LOC)
VALUES(:s, :p, :t, :dt, :u, :obs, :con :loc)`;
console.log(binds)
const conn = await oracledb.getConnection(credentials).catch(err => console.log('ERRO', err));
console.log("Conexão sucesso")
//oracledb.fetchAsString = [oracledb.DATE];
//let result = await conn.execute(`SELECT current_date, current_timestamp FROM DUAL`);
//console.log(result);
const result = await conn.executeMany(sql, binds, options).catch(err => console.log('ERRO', err));
console.log(sql);
console.log('Query: ' , result) //result.rowsAffected;
}