File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
docs/en/sql-reference/10-sql-commands/00-ddl/18-procedure Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : DESC PROCEDURE
3+ ---
4+ import FunctionDescription from '@site/src /components/FunctionDescription';
5+
6+ <FunctionDescription description =" Introduced or updated: v1.2.690 " />
7+
8+ Displays detailed information about a specific stored procedure.
9+
10+ ## Syntax
11+
12+ ``` sql
13+ DESC | DESCRIBE PROCEDURE < procedure_name> ([< parameter_type1> , < parameter_type2> , ...])
14+ ```
15+
16+ - If a procedure has no parameters, use empty parentheses: ` DESC PROCEDURE <procedure_name>() ` ;
17+ - For procedures with parameters, specify the exact types to avoid errors.
18+
19+ ## Examples
20+
21+ This example creates and then displays a stored procedure named ` sum_even_numbers ` .
22+
23+ ``` sql
24+ CREATE PROCEDURE sum_even_numbers(start_val UInt8, end_val UInt8)
25+ RETURNS UInt8 NOT NULL
26+ LANGUAGE SQL
27+ COMMENT= ' Calculate the sum of all even numbers'
28+ AS $$
29+ BEGIN
30+ LET sum := 0 ;
31+ FOR i IN start_val TO end_val DO
32+ IF i % 2 = 0 THEN
33+ sum := sum + i;
34+ END IF;
35+ END FOR;
36+
37+ RETURN sum;
38+ END;
39+ $$;
40+
41+ DESC PROCEDURE sum_even_numbers(Uint8, Uint8);
42+
43+ ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
44+ │ Property │ Value │
45+ ├───────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
46+ │ signature │ (start_val,end_val) │
47+ │ returns │ (UInt8) │
48+ │ language │ SQL │
49+ │ body │ BEGIN \n LET sum := 0 ;\n FOR i IN start_val TO end_val DO\n IF i % 2 = 0 THEN\n sum := sum + i;\n END IF;\n END FOR;\n \n RETURN sum;\nEND; │
50+ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
51+ ```
You can’t perform that action at this time.
0 commit comments