User Tools

Site Tools

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

Sidebar

**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]]

include

====== INCLUDE Statement ====== INCLUDE statement allows you to include statements from another HPL/SQL script. You can define user-defined functions and stored procedures in separate HPL/SQL scripts and then use INCLUDE statements to make them available in the current script. Additionally you can put INCLUDE statements to [[configuration##hplsqlrc-file|.hplsqlrc]] configuration file, so these functions and procedures are always available to users similar to persistent objects in the database. **Syntax**: <code language=sql> INLCUDE file_name; </code> Notes: * //file_name// is the path to the file (quoted or unquoted) or an expression **Example**: Create a separate file //set_message.sql// containing: <code language=sql> CREATE PROCEDURE set_message(IN name STRING, OUT result STRING) BEGIN SET result = 'Hello, ' || name || '!'; END; </code> The call the procedure from another script as follows: <code language=sql> INCLUDE set_message.sql DECLARE str STRING; CALL set_message('world', str); PRINT str; Result: -- Hello, world! </code> **Compatibility:** HPL/SQL extension **Version**: PL/HQL 0.3.1 See also: * [[call|CALL]] * [[create-function|CREATE FUNCTION]] * [[create-procedure|CREATE PROCEDURE]]