Skip to content

Commit 21712c2

Browse files
committed
Update json-object-insert.md
1 parent b1d511d commit 21712c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/en/sql-reference/20-sql-functions/10-semi-structured-functions/json-object-insert.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Inserts or updates a key-value pair in a JSON object.
1010
## Syntax
1111

1212
```sql
13-
JSON_OBJECT_INSERT(<json_object>, <key>, <value>[, true | false ])
13+
JSON_OBJECT_INSERT(<json_object>, <key>, <value>[, <update_flag>])
1414
```
1515

1616
| Parameter | Description | |
1717
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
1818
| `<json_object>` | The input JSON object. | |
1919
| `<key>` | The key to be inserted or updated. | |
2020
| `<value>` | The value to assign to the key. | |
21-
| `[, true | false]` | A boolean flag that controls whether to replace the value if the specified key already exists in the JSON object. If `true`, the function replaces the value if the key already exists. If `false` (or omitted), an error occurs if the key exists. | |
21+
| `<update_flag>` | A boolean flag that controls whether to replace the value if the specified key already exists in the JSON object. If `true`, the function replaces the value if the key already exists. If `false` (or omitted), an error occurs if the key exists. | |
2222

2323
## Return Type
2424

@@ -38,7 +38,7 @@ SELECT JSON_OBJECT_INSERT('{"a":1,"b":2,"d":4}'::variant, 'c', 3);
3838
└────────────────────────────────────────────────────────────┘
3939
```
4040

41-
This example shows how to update the value of an existing key 'a' from 1 to 10 using the boolean flag set to `true`, allowing the key's value to be replaced:
41+
This example shows how to update the value of an existing key 'a' from 1 to 10 using the update flag set to `true`, allowing the key's value to be replaced:
4242

4343
```sql
4444
SELECT JSON_OBJECT_INSERT('{"a":1,"b":2,"d":4}'::variant, 'a', 10, true);
@@ -50,7 +50,7 @@ SELECT JSON_OBJECT_INSERT('{"a":1,"b":2,"d":4}'::variant, 'a', 10, true);
5050
└───────────────────────────────────────────────────────────────────┘
5151
```
5252

53-
This example demonstrates an error that occurs when trying to insert a value for an existing key 'a' without specifying the boolean flag set to `true`:
53+
This example demonstrates an error that occurs when trying to insert a value for an existing key 'a' without specifying the update flag set to `true`:
5454

5555
```sql
5656
SELECT JSON_OBJECT_INSERT('{"a":1,"b":2,"d":4}'::variant, 'a', 10);

0 commit comments

Comments
 (0)