Skip to content

Commit 53abccc

Browse files
committed
Revert "docs: consolidate stored procedure scripting reference"
This reverts commit 9ba7606.
1 parent 9ba7606 commit 53abccc

File tree

15 files changed

+507
-667
lines changed

15 files changed

+507
-667
lines changed

docs/en/guides/54-query/02-advanced/stored-procedure.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A stored procedure is a set of executable commands or logic blocks stored within
77

88
## Supported Languages
99

10-
**Databend currently supports [SQL Scripting](/sql/stored-procedure-scripting/) only**. Using SQL scripting, users can define procedures with control flow constructs like loops (FOR, WHILE, REPEAT) and conditionals (IF, CASE), enabling complex logic and effective multi-step operations.
10+
**Databend currently supports [SQL Scripting](/sql/sql-reference/sql-scripting) only**. Using SQL scripting, users can define procedures with control flow constructs like loops (FOR, WHILE, REPEAT) and conditionals (IF, CASE), enabling complex logic and effective multi-step operations.
1111

1212
## Limitations
1313

@@ -62,3 +62,4 @@ CALL PROCEDURE sum_even_numbers(1, 10);
6262
│ 30 │
6363
└────────┘
6464
```
65+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Lambda Expressions
3+
---
4+
5+
Lambda expressions are anonymous functions that allow you to encapsulate logic and pass it as an argument to higher-order functions, such as those for processing arrays, lists, or other complex data types. It typically takes a set of input parameters and a body of code that is executed for each element in a collection or for each comparison in sorting logic.
6+
7+
## Syntax
8+
9+
```sql
10+
-- Take one parameter
11+
<parameter> -> <expression>
12+
13+
-- Take multiple parameters
14+
(<parameter1>, <parameter2>, ...) -> <expression>
15+
```
16+
17+
| Parameter | Description |
18+
|-----------------------------------|------------------------------------------------------------------------------------------------|
19+
| `<parameter1>, <parameter2>, ...` | Values that the Lambda will operate on (e.g., elements of an array). |
20+
| `->` | Separates the input parameters from the logic. |
21+
| `<expression>` | The logic that applies to the input parameters, often written as a conditional or calculation. |
22+
23+
## Examples
24+
25+
This lambda expression takes a single argument n and adds 5 to it:
26+
27+
```bash
28+
n -> (n + 5)
29+
```
30+
31+
This lambda expression takes an integer x and returns `Positive` if x is greater than 0, otherwise it returns `Non-Positive`:
32+
33+
```bash
34+
x -> (CASE WHEN x > 0 THEN 'Positive' ELSE 'Non-Positive' END)
35+
```
36+
37+
This lambda expression checks if num is even. It returns `true` for even numbers and `false` for odd numbers:
38+
39+
```bash
40+
num -> (num % 2 = 0)
41+
```
42+
43+
This lambda expression adds the two parameters x and y:
44+
45+
```bash
46+
(x, y) -> (x + y)
47+
```

0 commit comments

Comments
 (0)