User Tools

Site Tools

A PCRE internal error occured. This might be caused by a faulty plugin


**HPL/SQL is included to Apache Hive since version 2.0** * [[home|Home]]\\ * [[why|Why HPL/SQL]]\\ * [[features|Key Features]]\\ * [[start|Get Started]]\\ * [[doc|HPL/SQL Reference]]\\ * [[download|Download]]\\ * [[new|What's New]]\\ * [[about|About]]


====== CREATE PROCEDURE Statement ====== CREATE PROCEDURE statement allows you to create a user-defined SQL procedure (stored procedure). **Syntax**: <code language=sql> [ALTER | CREATE [OR REPLACE] | REPLACE] PROCEDURE | PROC procedure_name [parameters] [AS | IS] body parameters: ([IN | OUT | INOUT | IN OUT] name data_type, ...) | (name [IN | OUT | INOUT | IN OUT] data_type, ...) body: statement | expression | BEGIN statements END </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:** Oracle, Teradata, IBM DB2, Microsoft SQL Server, PostgreSQL, MySQL and Netezza **Version**: PL/HQL 0.3.1 See also: * [[udf-sproc|User-Defined Functions and Stored Procedures]] * [[call|CALL]] * [[create-package|CREATE PACKAGE]] * [[create-function|CREATE FUNCTION]] * [[include|INCLUDE]]