Skip to content

Commit 48d0baf

Browse files
committed
Documentation corrections and updtes
1 parent bc58a22 commit 48d0baf

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

doc/src/release_notes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Thin Mode Changes
1717
both before and after the RETURNING clause in a DML RETURNING statement``
1818
is now raised when the same bind variable placeholder name is used both
1919
before and after the RETURNING clause in a
20-
:ref:`DML RETURNING statement <dml-returning-bind>`. Previously, various
21-
internal errors were raised.
20+
:ref:`DML RETURNING statement <dmlreturn>`. Previously, various internal
21+
errors were raised.
2222
See `Issue #1652 <https://github.com/oracle/node-oracledb/issues/1652>`__.
2323

2424
#) Added support for Oracle Database 23c

doc/src/user_guide/bind.rst

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,6 @@ returned array length is not greater than one. This will help identify
361361
invalid data or an incorrect ``WHERE`` clause that causes more results
362362
to be returned.
363363

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-
369364
An example of DML RETURNING binds is:
370365

371366
.. code-block:: javascript
@@ -403,6 +398,36 @@ If the ``WHERE`` clause matches no rows, the output would be:
403398

404399
{ ids: [], rids: [] }
405400

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+
406431
.. _refcursors:
407432

408433
REF CURSOR Bind Parameters

0 commit comments

Comments
 (0)