How to call a user-defined function from SQL++ statements.
Calling the SQL++ User-Defined Function
An SQL++ user-defined function can be called from anywhere that a standard SQL++ function can be called.
-
Query Workbench
-
REST API
-
SQL++
-
Access the Query Workbench UI from the Administration Console.
-
Set the context to match the namespace of the function you are calling.
-
Enter the SQL++ statement in the query editor to run your function:
EXECUTE FUNCTION GetBusinessDays("02/14/2022", "04/16/2022");
-
Open up a shell session.
-
Execute a
curl
command to run the function:curl -v http://localhost:8093/query/service \ -u Administrator:password \ -d 'statement=EXECUTE FUNCTION default:`travel-sample`.inventory.GetBusinessDays("03/10/2022", "05/10.2022")'
Run the EXECUTE FUNCTION
function in the CBQ Shell.
EXECUTE FUNCTION default:`travel-sample`.`inventory`.GetBusinessDays("03/10/2022", "05/10.2022");
The SQL++ user-defined function can be used in any SQL++ statement in exactly the same way as a standard built-in function.
|