In node.js, the SQL command did not end correctly in Error (native)

I am using oracle in node.js and I want to insert my sql query.

I tried to insert my query, but I cannot insert.

That's my fault:

Error: ORA-00933: SQL command not properly ended

      

This is my SQL query.

INSERT INTO test VALUES ('P0315','hey');

      

So I tried this directly in sqlplus and the result is

1 row created.

      

Only in node.js, I find the error. I am using npm oracledb and this is my embed 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);
            }
        });
};

      

may i ask why it is not only node.js working? I'm sorry about my language skills and thanks for reading! :)

+3


source to share





All Articles