Skip to content

Commit d94817c

Browse files
committed
Mention object binding for DML RETURNING
1 parent e463f6d commit d94817c

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

doc/api.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4826,8 +4826,8 @@ may be used in `pool.getConnection()` like:
48264826
```javascript
48274827
const connection = await pool.getConnection(
48284828
{
4829-
user : 'hr',
4830-
password : mypw, // mypw contains the hr schema password
4829+
user : 'hr',
4830+
password : mypw, // mypw contains the hr schema password
48314831
}
48324832
);,
48334833
```
@@ -10664,15 +10664,30 @@ const bindVars = [
1066410664
1066510665
### <a name="dmlreturn"></a> 20.3 DML RETURNING Bind Parameters
1066610666
10667-
[DML][14] statements query or manipulate data in existing schema
10668-
objects.
10669-
10670-
Bind parameters from "DML RETURNING" statements (such as `INSERT
10671-
... RETURNING ... INTO ...`) can use `oracledb.BLOB`, `oracledb.CLOB`, `oracledb.STRING`,
10672-
`oracledb.NUMBER` or `oracledb.DATE` for the OUT [`type`](#executebindParams).
10673-
10674-
For `oracledb.STRING` types, an error occurs if [`maxSize`](#executebindParams)
10675-
is not large enough to hold a returned value.
10667+
"DML RETURNING" statements (such as `INSERT ... RETURNING ... INTO
10668+
...`) are a way information can be returned about row changes from
10669+
[DML][14] statements. For example you can use DML RETURNING to get
10670+
the ROWIDs of newly inserted rows. Another common use case is to
10671+
return [auto incremented column values ](#autoincrement).
10672+
10673+
Bind parameters for DML RETURNING statements can use `oracledb.BLOB`,
10674+
`oracledb.CLOB`, `oracledb.STRING`, `oracledb.NUMBER` or
10675+
`oracledb.DATE` for the BIND_OUT [`type`](#executebindParams). To
10676+
bind named Oracle objects use the class name or
10677+
[DbObject](#dbobjectclass) prototype class for the bind type, as shown
10678+
for object binds in [Fetching Oracle Database Objects and
10679+
Collections](#objects).
10680+
10681+
Oracle Database DATE, TIMESTAMP, TIMESTAMP WITH LOCAL TIME ZONE and
10682+
TIMESTAMP WITH TIME ZONE types can be bound as `oracledb.DATE` for DML
10683+
RETURNING. These types can also be bound as `oracledb.STRING`, if
10684+
desired. ROWID and UROWID data to be returned can be bound as
10685+
`oracledb.STRING`. Note that a string representing a UROWID may be up
10686+
to 5267 bytes long.
10687+
10688+
For `oracledb.STRING` types, an error occurs if
10689+
[`maxSize`](#executebindParams) is not large enough to hold a returned
10690+
value.
1067610691
1067710692
Note each DML RETURNING bind OUT parameter is returned as an array
1067810693
containing zero or more elements. Application code that is designed
@@ -10681,20 +10696,10 @@ returned array length is not greater than one. This will help identify
1068110696
invalid data or an incorrect `WHERE` clause that causes more results
1068210697
to be returned.
1068310698
10684-
Oracle Database DATE, TIMESTAMP, TIMESTAMP WITH LOCAL TIME ZONE
10685-
and TIMESTAMP WITH TIME ZONE types can be bound as `oracledb.DATE` for DML
10686-
RETURNING. These types can also be bound as `oracledb.STRING`, if desired.
10687-
ROWID and UROWID data to be returned can be bound as `oracledb.STRING`.
10688-
Note that a string representing a UROWID may be up to 5267 bytes
10689-
long.
10690-
1069110699
No duplicate binds are allowed in a DML statement with a `RETURNING`
1069210700
clause, and no duplication is allowed between bind parameters in the
1069310701
DML section and the `RETURNING` section of the statement.
1069410702
10695-
One common use case is to return an 'auto incremented' key values, see
10696-
[Auto-Increment Columns](#autoincrement).
10697-
1069810703
An example of DML RETURNING binds is:
1069910704
1070010705
```javascript

0 commit comments

Comments
 (0)