Skip to content

Commit ced3bb1

Browse files
committed
Applying review changes to the documentation of OQL INSERT
1 parent 3fe4001 commit ced3bb1

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

content/en/docs/refguide/modeling/domain-model/oql/oql-statements.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,20 @@ SET
156156

157157
## `INSERT` Statement {#oql-insert}
158158

159+
You can use the `INSERT` statement to insert new entity objects into your data. You can do this in two ways:
160+
161+
* using an OQL query – extracting data and use it to insert one or more new objects
162+
* using values – specifying explicit values and use these to insert one or more new objects
163+
159164
{{% alert color="info" %}}
160-
Available from Mendix version 11.6.0 when sourcing data from an oql query.
161-
Available from Mendix version 11.13.0 when using `VALUES` to specify rows directly.
165+
Available from Mendix version 11.6.0.
166+
You can use an OQL query from Mendix version 11.6.0.
167+
You can use values from Mendix version 11.13.0.
162168
{{% /alert %}}
163169

164-
`INSERT` statements can be written with values or queries.
170+
### `INSERT` with OQL Query
165171

166-
### `INSERT` with query
172+
Insert with OQL query allows you to extract data using an OQL query and insert those values as one or more entity objects.
167173

168174
```sql
169175
INSERT INTO <entity> ( <attribute> | <association> [ , …n ] ) <oql-query>
@@ -185,7 +191,9 @@ INSERT INTO Module.Order ( OrderNumber, CustomerNumber, Module.Order_Customer )
185191
SELECT NewOrderNumber, Loader.TemporaryData_Customer/Loader.Customer/Number, Loader.TemporaryData_Customer FROM Loader.TemporaryData
186192
```
187193

188-
### `INSERT` with `VALUES`
194+
### `INSERT` with Values
195+
196+
Insert with values allows you to insert a list of literals, OQL parameters, and OQL expressions as one or more entity objects.
189197

190198
```sql
191199
INSERT INTO <entity> ( <attribute> [ , …n ] ) VALUES (<expression 1> [, …<expression n>]) [ …, (<expression 1> [, …<expression n>])]
@@ -195,9 +203,11 @@ INSERT INTO <entity> ( <attribute> [ , …n ] ) VALUES (<expression 1> [, …<ex
195203

196204
* `attribute` is an attribute of the entity that will be inserted.
197205

198-
* `expression n` is any valid OQL expression with literals or OQL parameters.
199-
Every row must contain the same number of values of compatible types.
200-
This query can *not* select data from any entities.
206+
{{% alert color="info" %}}You cannot insert associations when inserting with values.{{% /alert %}}
207+
208+
* `expression x` is any valid expression consisting solely of literals or OQL expressions. Every row must contain the same number of values of compatible types as the list of attributes you are inserting for each entity object.
209+
210+
{{% alert color="info" %}}This expression cannot use OQL clauses to select data from any entities.{{% /alert %}}
201211

202212
Example:
203213

0 commit comments

Comments
 (0)