Skip to content

Commit 8ee7bca

Browse files
authored
Merge pull request mendix#9030 from dahfjkg/dat/oqlv2-mandatory-attr-names
Mention that aliases are required for functions in OQL v2
2 parents c9552a8 + a03ff95 commit 8ee7bca

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • content/en/docs/refguide/modeling/domain-model/oql

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ In OQL v2, the date arguments of functions [DATEPART](/refguide/oql-expression-s
7272
* String. In this case, Runtime will implicitly attempt conversion of the string to a Date and time.
7373
* One of Numeric types Integer, Long and Decimal. In this case, the value is treated as a Java timestamp.
7474

75-
### Subquery Columns Should Have a Name or an Alias
75+
### Columns Should Have a Name or an Alias
7676

77-
In OQL v1, when a column in the `SELECT` clause is a subquery, it was possible for it not to have a name. For example:
77+
In OQL v1, when a column in the `SELECT` clause was a subquery, a function, or a constant, it was possible for it not to have a name. For example:
7878

7979
```sql
8080
SELECT
8181
Name,
82+
LENGTH(Name),
8283
(
8384
SELECT COUNT(*)
8485
FROM Module.Person
@@ -87,13 +88,14 @@ SELECT
8788
FROM Module.City
8889
```
8990

90-
The column names in this case would be `Name` and a `null` name which would not be possible to refer to.
91+
The column names in this case would be `Name` and multiple columns named `null` which could not be referred to.
9192

92-
In OQL v2, such queries are no longer allowed. You must always provide an alias for subqueries that do not result in a named column. The query above can be rewritten as follows:
93+
In OQL v2, such queries are no longer allowed. You must always provide an alias for expressions that do not result in a named column. The query above can be rewritten as follows:
9394

9495
```sql
9596
SELECT
9697
Name,
98+
LENGTH(Name) AS NameLength,
9799
(
98100
SELECT COUNT(*)
99101
FROM Module.Person

0 commit comments

Comments
 (0)