Skip to content

Document new OQL feature: INSERT ... VALUES#11543

Open
passalaqua wants to merge 1 commit into
mendix:developmentfrom
passalaqua:dat/feature/insert-values
Open

Document new OQL feature: INSERT ... VALUES#11543
passalaqua wants to merge 1 commit into
mendix:developmentfrom
passalaqua:dat/feature/insert-values

Conversation

@passalaqua

Copy link
Copy Markdown
Contributor

To be released with 11.13.

Comment thread content/en/docs/refguide/modeling/domain-model/oql/oql-statements.md Outdated
Comment thread content/en/docs/refguide/modeling/domain-model/oql/oql-statements.md Outdated
Comment thread content/en/docs/refguide/modeling/domain-model/oql/oql-statements.md Outdated
@passalaqua passalaqua force-pushed the dat/feature/insert-values branch from d97ed1f to 3fe4001 Compare July 15, 2026 13:47
@dahfjkg

dahfjkg commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Passed team review

@MarkvanMents MarkvanMents left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @passalaqua
I've expanded the introduction to explain what each option does, rather than just leap into the syntax.
I've also tried to expand the syntax description to try to make it clear what you can use. I found the explanation of a "valid expression" was a bit unclear in the terminology so I've tried to clarify.
Hope I haven't made things worse!

Comment on lines +160 to +165
Available from Mendix version 11.6.0 when sourcing data from an oql query.
Available from Mendix version 11.13.0 when using `VALUES` to specify rows directly.
{{% /alert %}}

The syntax of `INSERT` statements is:
`INSERT` statements can be written with values or queries.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a bit more information here:

Suggested change
Available from Mendix version 11.6.0 when sourcing data from an oql query.
Available from Mendix version 11.13.0 when using `VALUES` to specify rows directly.
{{% /alert %}}
The syntax of `INSERT` statements is:
`INSERT` statements can be written with values or queries.
You can use the `INSERT` statement to insert new entity objects into your data. You can do this in two ways:
* using an OQL query – extracting data and use it to insert one or more new objects
* using values – specifying explicit values and use these to insert one or more new objects
{{% alert color="info" %}}
Available from Mendix version 11.6.0.
You can use an OQL query from Mendix version 11.6.0.
You can use values from Mendix version 11.13.0.
{{% /alert %}}

The syntax of `INSERT` statements is:
`INSERT` statements can be written with values or queries.

### `INSERT` with query

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### `INSERT` with query
### `INSERT` with OQL Query
Insert with OQL query allows you to extract data using an OQL query and insert those values as one or more entity objects.

SELECT NewOrderNumber, Loader.TemporaryData_Customer/Loader.Customer/Number, Loader.TemporaryData_Customer FROM Loader.TemporaryData
```

### `INSERT` with `VALUES`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### `INSERT` with `VALUES`
### `INSERT` with Values
Insert with values allows you to insert a list of literals or OQL parameters as one or more entity objects.

Comment on lines +198 to +200
* `expression n` is any valid OQL expression with literals or OQL parameters.
Every row must contain the same number of values of compatible types.
This query can *not* select data from any entities.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `expression n` is any valid OQL expression with literals or OQL parameters.
Every row must contain the same number of values of compatible types.
This query can *not* select data from any entities.
* `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.
{{% alert color="info" %}}This expression cannot use OQL clauses to select data from any entities.{{% /alert %}}


* `entity` is the entity for which new objects will be created.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `attribute` is an attribute of the entity that will be inserted.
* `attribute` is an attribute of the entity that will be inserted.
{{% alert color="info" %}}You cannot insert associations when inserting with values.{{% /alert %}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants