Skip to content

Commit 6cad595

Browse files
committed
Docs for binding parameters
Signed-off-by: worksofliam <[email protected]>
1 parent df75a7d commit 6cad595

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/content/docs/extensions/db2i/index.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ update: select * from sample.employee;
7777

7878
Enter the value `null` to set a column to *null*. If the column cannot accept at least 4 characters, then `-` (a dash) may be used.
7979

80+
### Binding parameters
81+
82+
It is possible to bind to SQL parameters inside of SQL statements - both `?` markers and named parameters (e.g. `:param1`) are supported - by using the `bind:` prefix. `bind:` is followed by a list of strings or numbers, either space or comma separated. When executing the prefix, it will find the most previous statement in the document to bind to.
83+
84+
```sql
85+
select * from employee where empno = ?;
86+
87+
bind: '000010';
88+
bind: '000020';
89+
90+
select * from employee where empno = ? and workdept = ?;
91+
92+
bind: '000010', 'A00';
93+
bind: '000020', 'A00';
94+
```
95+
8096
## Syntax checking
8197

8298
When connected to an IBM i, the syntax checker has the following options:

0 commit comments

Comments
 (0)