|
1 |
| -/* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. */ |
| 1 | +/* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. */ |
2 | 2 |
|
3 | 3 | /******************************************************************************
|
4 | 4 | *
|
|
23 | 23 | *
|
24 | 24 | * To insert many records at a time see em_insert1.js
|
25 | 25 | *
|
| 26 | + * This example requires node-oracledb 4.2 or later. |
26 | 27 | * This example uses Node 8's async/await syntax.
|
27 | 28 | *
|
28 | 29 | *****************************************************************************/
|
@@ -66,20 +67,23 @@ async function run() {
|
66 | 67 | { id : {val: 1 }, nm : {val: 'Chris'} }
|
67 | 68 | );
|
68 | 69 | console.log("Rows inserted: " + result.rowsAffected); // 1
|
| 70 | + console.log("ROWID of new row: " + result.lastRowid); |
69 | 71 |
|
70 | 72 | // 'bind by position' syntax
|
71 | 73 | result = await connection.execute(
|
72 | 74 | `INSERT INTO no_tab1 VALUES (:id, :nm)`,
|
73 | 75 | [2, 'Alison']
|
74 | 76 | );
|
75 | 77 | console.log("Rows inserted: " + result.rowsAffected); // 1
|
| 78 | + console.log("ROWID of new row: " + result.lastRowid); |
76 | 79 |
|
77 | 80 | result = await connection.execute(
|
78 | 81 | `UPDATE no_tab1 SET name = :nm`,
|
79 | 82 | ['Bambi'],
|
80 | 83 | { autoCommit: true } // commit once for all DML in the script
|
81 | 84 | );
|
82 | 85 | console.log("Rows updated: " + result.rowsAffected); // 2
|
| 86 | + console.log("ROWID of final row updated: " + result.lastRowid); // only gives one |
83 | 87 |
|
84 | 88 | } catch (err) {
|
85 | 89 | console.error(err);
|
|
0 commit comments