@@ -499,7 +499,8 @@ For installation information, see the [Node-oracledb Installation Instructions][
499
499
- 21.4 [REF CURSOR Bind Parameters](#refcursors)
500
500
- 21.5 [LOB Bind Parameters](#lobbinds)
501
501
- 21.6 [Binding Multiple Values to a SQL `WHERE IN` Clause](#sqlwherein)
502
- - 21.7 [Binding Column and Table Names in Queries](#sqlbindtablename)
502
+ - 21.7 [Binding in a `LIKE` or `REGEXP_LIKE` Clause](#sqlbindlike)
503
+ - 21.8 [Binding Column and Table Names in Queries](#sqlbindtablename)
503
504
22. [Oracle Database Objects and Collections](#objects)
504
505
- 22.1 [Inserting Objects](#objectinsert)
505
506
- 22.2 [Fetching Objects](#objectfetch)
@@ -13731,7 +13732,47 @@ for really large numbers of items, you might prefer to use a global
13731
13732
temporary table. Some solutions are given in [On Cursors, SQL, and
13732
13733
Analytics][59] and in [this StackOverflow answer][60].
13733
13734
13734
- ### <a name="sqlbindtablename"></a> 21.7 Binding Column and Table Names in Queries
13735
+ ### <a name="sqlbindlike"></a> 21.7 Binding in a `LIKE` or `REGEXP_LIKE` Clause
13736
+
13737
+ To do pattern matching with a `LIKE` clause, bind a string containing the
13738
+ pattern match wildcards, for example:
13739
+
13740
+ ```javascript
13741
+ const pattern = "%uth%";
13742
+
13743
+ result = await connection.execute(
13744
+ `SELECT CITY FROM LOCATIONS WHERE CITY LIKE :bv`,
13745
+ { bv: pattern }
13746
+ );
13747
+ console.log(result.rows[0]);
13748
+ ```
13749
+
13750
+ Output is like:
13751
+
13752
+ ```
13753
+ [ [ 'South Brunswick' ], [ 'South San Francisco' ], [ 'Southlake' ] ]
13754
+ ```
13755
+
13756
+ The same is true for regular expression functions such as `REGEXP_LIKE` and
13757
+ `REGEXP_SUBSTR`. For example:
13758
+
13759
+ ```javascript
13760
+ const pattern = ',[^,]+,';
13761
+
13762
+ result = await connection.execute(
13763
+ `SELECT REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA', :bv) FROM DUAL`,
13764
+ { bv: pattern }
13765
+ );
13766
+ console.log(result.rows);
13767
+ ```
13768
+
13769
+ Output is like:
13770
+
13771
+ ```
13772
+ [ [ ', Redwood Shores,' ] ]
13773
+ ```
13774
+
13775
+ ### <a name="sqlbindtablename"></a> 21.8 Binding Column and Table Names in Queries
13735
13776
13736
13777
It is not possible to bind table names in queries. Instead use a
13737
13778
hard-coded Allow List of names to build the final SQL statement, for
0 commit comments