From 2f5722676ef3f6c7bc63a0984dd96f28fb833306 Mon Sep 17 00:00:00 2001 From: Manfred Moser Date: Thu, 23 Nov 2023 10:42:52 -0800 Subject: [PATCH] Improve SQL routine docs --- docs/src/main/sphinx/routines/function.md | 2 +- docs/src/main/sphinx/routines/introduction.md | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/src/main/sphinx/routines/function.md b/docs/src/main/sphinx/routines/function.md index 151578437c0b..21df3a95c392 100644 --- a/docs/src/main/sphinx/routines/function.md +++ b/docs/src/main/sphinx/routines/function.md @@ -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 ] diff --git a/docs/src/main/sphinx/routines/introduction.md b/docs/src/main/sphinx/routines/introduction.md index d1191ae7dab1..ab3377ba75a1 100644 --- a/docs/src/main/sphinx/routines/introduction.md +++ b/docs/src/main/sphinx/routines/introduction.md @@ -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 @@ -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.