This shows you the differences between two versions of the page.
udf-sproc [2015/09/23 20:27] 127.0.0.1 external edit |
udf-sproc [2016/02/19 07:24] (current) dmtolpeko |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== User-Defined Functions and Stored Procedures ======= | ====== User-Defined Functions and Stored Procedures ======= | ||
- | PL/HQL allows you to defined user-defined functions and stored procedures using [[create-function|CREATE FUNCTION]] and [[create-procedure|CREATE PROCEDURE]] statements, respectively. | + | HPL/SQL allows you to defined user-defined functions and stored procedures using [[create-function|CREATE FUNCTION]] and [[create-procedure|CREATE PROCEDURE]] statements, respectively. |
===== Define Functions and Procedures in the Current Script ===== | ===== Define Functions and Procedures in the Current Script ===== | ||
- | The easiest way to use PL/HQL functions and procedures is to define them in the current script before their actual use. | + | The easiest way to use HPL/SQL functions and procedures is to define them in the current script before their actual use. |
For example: | For example: | ||
Line 30: | Line 30: | ||
</code> | </code> | ||
- | Once defined the function can be used in any PL/HQL and HQL expression as a built-in function. You can invoke a procedure using the [[call|CALL]] statement. | + | Once defined the function can be used in any HPL/SQL and HQL expression as a built-in function. You can invoke a procedure using the [[call|CALL]] statement. |
===== Permanent Functions and Stored Procedures ===== | ===== Permanent Functions and Stored Procedures ===== | ||
- | PL/HQL allows you to share functions and procedures between PL/HQL scripts so you do not need to put their content to every script. | + | HPL/SQL allows you to share functions and procedures between HPL/SQL scripts so you do not need to put their content to every script. |
- | Unlike databases that typically store functions and stored procedures in the database catalog, PL/HQL stores them in local files. There are several options how to you can include functions and procedures: | + | Unlike databases that typically store functions and stored procedures in the database catalog, HPL/SQL stores them in local files. There are several options how to you can include functions and procedures: |
- | * Use //.plhqlrc// file | + | * Use //.hplsqlrc// file |
- | You can put your functions and procedures to //.plhqlrc// file. The content of this file is automatically executed when you start //plhql// tool. For more information, see [[configuration#plhqlrc-file|.plhqlrc]] file. | + | You can put your functions and procedures to //.hplsqlrc// file. The content of this file is automatically executed when you start //hplsql// tool. For more information, see [[configuration#hplsqlrc-file|.hplsqlrc]] file. |
* INCLUDE statement | * INCLUDE statement | ||
- | Using [[include|INCLUDE]] statement you can load function and procedures definitions from any file. Note that you can also use [[include|INCLUDE]] statements in [[configuration#plhqlrc-file|.plhqlrc]] file. | + | Using [[include|INCLUDE]] statement you can load function and procedures definitions from any file. Note that you can also use [[include|INCLUDE]] statements in [[configuration#hplsqlrc-file|.hplsqlrc]] file. |
- | ===== Using PL/HQL User-Defined Functions in Hive Queries ===== | + | ===== Using HPL/SQL User-Defined Functions in Hive Queries ===== |
- | PL/HQL allows you to invoke user-defined functions written in PL/HQL language from Hive queries the same way as you use HQL built-in functions. | + | HPL/SQL allows you to invoke user-defined functions written in HPL/SQL language from Hive queries the same way as you use HQL built-in functions. |
- | PL/HQL CLI tool automatically puts referenced PL/HQL functions and procedures to Distributed Cache, registers the Hive UDF and modifies the function call in the SQL statements. For more information, see [[udf|Hive UDF to Run PL/HQL Scripts]]. | + | HPL/SQL CLI tool automatically puts referenced HPL/SQL functions and procedures to Distributed Cache, registers the Hive UDF and modifies the function call in the SQL statements. For more information, see [[udf|Hive UDF to Run HPL/HQL Scripts]]. |
- | **Version**: PL/HQL 0.3.1 | + | **Version**: HPL/SQL 0.3.1 |
See also: | See also: |