Skip to content

Commit

Permalink
Improve SQL routine docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabua committed Nov 29, 2023
1 parent 8b215c2 commit 2f57226
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/main/sphinx/routines/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```text
FUNCTION name ( [ parameter_name data_type [, ...] ] )
RETURNS type
[ LANGUAGE langauge]
[ LANGUAGE language]
[ NOT? DETERMINISTIC ]
[ RETURNS NULL ON NULL INPUT ]
[ CALLED ON NULL INPUT ]
Expand Down
17 changes: 11 additions & 6 deletions docs/src/main/sphinx/routines/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ before the following keywords:
* `REPEAT`
* `WHILE`

The label is used to name the block in order to continue processing with the
`ITERATE` statement or exit the block with the `LEAVE` statement. This flow
control is supported for nested blocks, allowing to continue or exit an outer
block, not just the innermost block. For example, the following snippet uses the
label `top` to name the complete block from `REPEAT` to `END REPEAT`:
The label is used to name the block to continue processing with the `ITERATE`
statement or exit the block with the `LEAVE` statement. This flow control is
supported for nested blocks, allowing to continue or exit an outer block, not
just the innermost block. For example, the following snippet uses the label
`top` to name the complete block from `REPEAT` to `END REPEAT`:

```sql
top: REPEAT
Expand Down Expand Up @@ -171,7 +171,12 @@ when writing and running SQL routines:

The following limitations apply to SQL routines.

* Routines must be declared before than can be referenced.
* Routines must be declared before they are referenced.
* Recursion cannot be declared or processed.
* Mutual recursion can not be declared or processed.
* Queries cannot be processed in a routine.

Specifically this means that routines can not use `SELECT` queries to retrieve
data or any other queries to process data within the routine. Instead queries
can use routines to process data. Routines only work on data provided as input
values and only provide output data from the `RETURN` statement.

0 comments on commit 2f57226

Please sign in to comment.