Skip to content

Error: NJS-005: invalid value for parameter 2 #1401

@kleyton032

Description

@kleyton032
  1. What versions are you using?
    Node - v12.18.2
    node-oracledb#v5.1.0

Give your database version.
oracle 11g

  1. Describe the problem

I have a problem trying to make an insert, compile error - Error: NJS-005: invalid value for parameter 2

  1. 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;

}


Include all SQL needed to create the database schema.
image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions