This shows you the differences between two versions of the page.
call [2015/09/23 20:26] |
call [2015/09/23 20:26] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CALL Statement - PL/HQL ====== | ||
+ | CALL statement allows you to execute a stored procedure. | ||
+ | |||
+ | **Syntax**: | ||
+ | |||
+ | <code language=sql> | ||
+ | CALL procedure_name [(parameter, ...)]; | ||
+ | </code> | ||
+ | |||
+ | **Example**: | ||
+ | |||
+ | Define a procedure and then call passing a parameter: | ||
+ | |||
+ | <code language=sql> | ||
+ | CREATE PROCEDURE set_message(IN name STRING, OUT result STRING) | ||
+ | BEGIN | ||
+ | SET result = 'Hello, ' || name || '!'; | ||
+ | END; | ||
+ | |||
+ | -- Now call the procedure and print the results | ||
+ | DECLARE str STRING; | ||
+ | CALL set_message('world', str); | ||
+ | PRINT str; | ||
+ | |||
+ | Result: | ||
+ | -- | ||
+ | Hello, world! | ||
+ | </code> | ||
+ | |||
+ | **Compatibility:** Teradata, IBM DB2 and MySQL | ||
+ | |||
+ | **Version**: PL/HQL 0.3.1 | ||
+ | |||
+ | See also: | ||
+ | * [[udf-sproc|User-Defined Functions and Stored Procedures]] | ||
+ | * [[create-function|CREATE FUNCTION]] | ||
+ | * [[create-procedure|CREATE PROCEDURE]] | ||
+ | * [[include|INCLUDE]] |