@@ -9,25 +9,25 @@ When adapting a standard DSQL command to use `EXECUTE BLOCK` (for instance, to u
99input parameter in multiple places), the developer is currently forced to explicitly declare all input parameters and,
1010more tediously, all output fields.
1111
12- The ` USING ` statement simplifies this workflow. It provides the ability to declare parameters and sub-routines while
13- allowing the engine to infer outputs automatically from the contained SQL command.
12+ The ` USING ` statement simplifies this workflow. It provides the ability to declare parameters, sub-routines and
13+ variables while allowing the engine to infer outputs automatically from the contained SQL command.
1414
1515## Syntax
1616
1717``` sql
1818USING [ ( < input_parameter_list> ) ]
19- [ < subroutines > ]
19+ [ < local_declarations > ]
2020DO < sql_command>
2121```
2222
23- ** Note:** At least one of ` <input_parameter_list> ` or ` <subroutines > ` must be present. A ` USING ... DO ` statement
24- without parameters and without subroutines is invalid.
23+ ** Note:** At least one of ` <input_parameter_list> ` or ` <local_declarations > ` must be present. A ` USING DO ... ` statement
24+ without parameters and without local declarations is invalid.
2525
2626### Components
2727
2828* ** ` <input_parameter_list> ` ** : A strictly typed list of parameters. These can be bound to values using the ` ? `
2929 placeholder.
30- * ** ` <subroutines > ` ** : Standard PSQL function or procedure declarations .
30+ * ** ` <local_declarations > ` ** : Standard PSQL local declarations (variables, sub-functions and sub-procedures) .
3131* ** ` <sql_command> ` ** : The DSQL statement to execute. Supported statements include:
3232 * ` SELECT `
3333 * ` INSERT ` (with or without ` RETURNING ` )
@@ -51,9 +51,9 @@ without parameters and without subroutines is invalid.
5151
5252## Examples
5353
54- ### 1. Basic Parameter Reuse and Subroutines
54+ ### 1. Basic Parameter Reuse and Local Declarations
5555
56- This example demonstrates declaring typed parameters, defining local functions/procedures , and using them in a query.
56+ This example demonstrates declaring typed parameters, defining sub-routines , and using them in a query.
5757
5858``` sql
5959using (p1 integer = ?, p2 integer = ?)
@@ -123,10 +123,10 @@ end
123123
124124## Comparison
125125
126- | Feature | Standard DSQL | ` EXECUTE BLOCK ` | ` USING ` |
127- | :---------------------- | :------------------------------ | :-------------------------------------------- | :-------------------------------------------- |
128- | ** Subroutines ** | No | Yes | Yes |
129- | ** Input Declarations** | Implicit (Positional) | Explicit | Hybrid (implicit and explicit) |
130- | ** Output Declarations** | Inferred | Explicit (` RETURNS ` ) | Inferred |
131- | ** Verbosity** | Low | High | Medium |
132- | ** Use Case** | Simple queries | Complex logic, loops, no result set inference | Reusing params, subroutines , standard queries |
126+ | Feature | Standard DSQL | ` EXECUTE BLOCK ` | ` USING ` |
127+ | :---------------------- | :------------------------------ | :-------------------------------------------- | :-------------------------------------------------------- |
128+ | ** Local Declarations ** | No | Yes | Yes |
129+ | ** Input Declarations** | Implicit (Positional) | Explicit | Hybrid (implicit and explicit) |
130+ | ** Output Declarations** | Inferred | Explicit (` RETURNS ` ) | Inferred |
131+ | ** Verbosity** | Low | High | Medium |
132+ | ** Use Case** | Simple queries | Complex logic, loops, no result set inference | Reusing params, variables, sub-routines , standard queries |
0 commit comments