Calls an SQL function in the same way as calling a built-in function.

Syntax

select <function_name>(<column_name>[,...]) from <table_name>;

Parameters

  • function_name: the name of the created SQL function.
  • column_name: the column name of the table from which you want to query data. The data type of the column must be the same as the data type defined by the SQL function.
  • table_name: the name of the table from which you want to query data.

Examples

-- Create a table named src. 
create table src (c bigint, d string);
insert into table src values (1,100.1),(2,100.2),(3,100.3);
-- Call the my_add function. 
select my_add(c) from src;
-- The following result is returned: 
+------------+
| _c0        |
+------------+
| 2          |
| 3          |
| 4          |
+------------+

Related statements

  • CREATE SQL FUNCTION: After you create a permanent SQL function and store it in the metadata system, all the query statements can reference this function.
  • FUNCTION: If you do not need to store SQL functions in the metadata system of MaxCompute, you can create temporary SQL functions.
  • DESC FUNCTION: Views the information of a specified user-defined function (UDF) in a MaxCompute project. The information includes the name, owner, creation time, class name, and resource list of the UDF.
  • LIST FUNCTIONS: Views the information of all UDFs in a MaxCompute project.
  • DROP FUNCTION: Deletes an existing UDF from a MaxCompute project.