2023-05-15 17:39:13 +03:00
|
|
|
# Transform
|
|
|
|
```
|
|
|
|
<transform> ::=
|
|
|
|
[ WITH [ <common-table-expression> [ ,...n ] ]
|
|
|
|
[ <cte-lib> [ AS ] <alias> [ ,...n ] ]
|
|
|
|
]
|
|
|
|
<cmd>
|
|
|
|
[ INTO <table>
|
|
|
|
| <set-op> [ ( ] <cmd> [ ) ]
|
|
|
|
] [ ...n ]
|
|
|
|
[ AS OF { NOW
|
|
|
|
| <timestamp>
|
|
|
|
| n { SECONDS | MINUTES | HOURS | DAYS | WEEKS | MONTHS | YEARS } AGO
|
|
|
|
| <inline-scalar>
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
2023-05-18 05:51:26 +03:00
|
|
|
|
|
|
|
`<cte-lib>` pre-built library of `<common-table-expression>`, TBD.
|
|
|
|
|
|
|
|
`INTO <table>` inserts resulting `<table-set>` into `<table>`. Prior `<cmd>` is terminal.
|
|
|
|
|
|
|
|
`AS OF` defaults to `NOW`.
|
|
|
|
`AS OF <inline-scalar>` inline Scalar function that returns `<timestamp>`.
|
|
|
|
|
2023-05-15 17:39:13 +03:00
|
|
|
```
|
|
|
|
<set-op> ::=
|
|
|
|
UNION
|
|
|
|
| EXCEPT
|
|
|
|
| INTERSECT
|
|
|
|
| DIVIDED BY [ WITH REMAINDER ]
|
|
|
|
| PASS-THRU
|
|
|
|
| NOP
|
|
|
|
| TEE
|
|
|
|
| MULTEE
|
|
|
|
```
|
2023-05-18 05:51:26 +03:00
|
|
|
Set operators `UNION`, etc. apply the previous result collection to the next query result or result from nested queries `( ... )`.
|
2023-05-15 17:39:13 +03:00
|
|
|
Left paren `(` can only exist singly, but right paren `)` may be stacked to any depth `...)))`.
|
|
|
|
|
2023-05-18 23:24:00 +03:00
|
|
|
```
|
|
|
|
<cmd> ::=
|
|
|
|
<delete>
|
|
|
|
| <insert>
|
|
|
|
| <merge>
|
|
|
|
| <query>
|
|
|
|
| <update>
|
|
|
|
```
|
|
|
|
|
2023-05-18 05:51:26 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
<set-functions> ::=
|
|
|
|
<cmd> | <set-op>
|
|
|
|
```
|
|
|
|
|
|
|
|
API:
|
|
|
|
```
|
|
|
|
+$ transform
|
|
|
|
$:
|
|
|
|
%transform
|
|
|
|
ctes=(list <common-table-expression>)
|
|
|
|
(tree <set-functions>)
|
|
|
|
==
|
|
|
|
```
|
2023-05-15 17:39:13 +03:00
|
|
|
|
2023-05-22 07:24:31 +03:00
|
|
|
## Arguments
|
|
|
|
|
|
|
|
** **
|
|
|
|
|
|
|
|
## Remarks
|
|
|
|
|
2023-05-25 05:33:27 +03:00
|
|
|
`<transform>` within a CTE may not have its own `WITH` clause.
|
|
|
|
|
|
|
|
The `<transform>` `WITH` clause, in which CTEs are grouped, makes each CTE available to subsequent CTEs defined in the parent `<transform>`.
|
|
|
|
|
|
|
|
When used as a `<common-table-expression>` (CTE) `<transform>` output must be a pass-thru virtual-table.
|
|
|
|
|
2023-05-22 07:24:31 +03:00
|
|
|
## Produced Metadata
|
|
|
|
|
2023-05-15 17:39:13 +03:00
|
|
|
## Exceptions
|
|
|
|
`<table>` does not exist
|
|
|
|
`GRANT` permission on `<table>` violated
|
|
|
|
`AS OF` prior to `<table>` component creation
|