Reputation: 51
I'm using oracle in node.js, and I want to insert my sql query.
I tried to insert my query, but i can't insert.
This is my error:
Error: ORA-00933: SQL command not properly ended
This is my SQL query.
INSERT INTO test VALUES ('P0315','hey');
So, I tried it in sqlplus directly, and result is
1 row created.
Only in node.js, I find error. I use npm oracledb, and this is my insert code.
var sql = "INSERT INTO test VALUES ('P0315','hey');";
var doinsert1 = function (conn, cb) {
console.log(sql);
conn.execute(
sql,
function(err, result)
{
if (err) {
return cb(err, conn);
} else {
console.log("Rows inserted: " + result.rowsAffected); // 1
return cb(null, conn);
}
});
};
can I ask why it doesn't work in only node.js?
Upvotes: 5
Views: 1478
Reputation: 2626
Syntax in npm oracledb
should not have a semi-colon in the SQL statement
Upvotes: 3