@@ -361,11 +361,6 @@ returned array length is not greater than one. This will help identify
361
361
invalid data or an incorrect ``WHERE `` clause that causes more results
362
362
to be returned.
363
363
364
- Duplicate binds (using the same bind name more than once in the
365
- statement) are not allowed in a DML statement with a ``RETURNING ``
366
- clause, and no duplication is allowed between bind parameters in the DML
367
- section and the ``RETURNING `` section of the statement.
368
-
369
364
An example of DML RETURNING binds is:
370
365
371
366
.. code-block :: javascript
@@ -403,6 +398,36 @@ If the ``WHERE`` clause matches no rows, the output would be:
403
398
404
399
{ ids: [], rids: [] }
405
400
401
+ The same bind variable placeholder name cannot be used both before and after
402
+ the RETURNING clause. Consider the example below.
403
+
404
+ .. code-block :: javascript
405
+
406
+ // a variable cannot be used for both input and output in a DML returning
407
+ // statement
408
+ const result = await connection .execute (
409
+ ` UPDATE mytab SET name = :name || ' EXTRA TEXT'
410
+ WHERE id = :id
411
+ RETURNING name INTO :name` ,
412
+ {
413
+ id: 1001 ,
414
+ name: { type: oracledb .STRING , val: " Krishna" , dir: oracledb .BIND_INOUT , maxSize: 100 }
415
+ }
416
+ );
417
+ console .log (result .outBinds .name );
418
+
419
+ Here, the ``:name `` bind variable is used both before and after the RETURNING
420
+ clause. In node-oracledb Thick mode, the bind variable will not be updated as
421
+ expected with the ' EXTRA TEXT' value and no error is thrown. The Thick mode
422
+ prints the following output::
423
+
424
+ Krishna
425
+
426
+ With node-oracledb Thin mode, the above example returns the following error::
427
+
428
+ NJS-149: the bind variable placeholder "NAME" cannot be used both before
429
+ and after the RETURNING clause in a DML RETURNING statement
430
+
406
431
.. _refcursors :
407
432
408
433
REF CURSOR Bind Parameters
0 commit comments