4D v16

4d_function_call

Home

 
4D v16
4d_function_call

4d_function_call  


 

 

 Command 4d_function_{FN sql_name ([arithmetic_expression, ..., arithmetic_expression]) AS sql_data_type_name}

A 4d_function_call can be used to execute a 4D function that returns a value.

The sql_name of the function is preceded by the FN keyword and followed by one or more arithmetic_expression type arguments. The value returned by the function will be of the type defined by the sql_data_type_name passed.

Example  

Here is an example using functions to extract from the MOVIES table the number of actors for each movie having at least 7 actors:

 C_LONGINT($NrOfActors)
 ARRAY TEXT(aMovieTitles;0)
 ARRAY LONGINT(aNrActors;0)
 
 $NrOfActors:=7
 Begin SQL
    SELECT Movie_Title, {FN Find_Nr_Of_Actors(ID) AS NUMERIC}
    FROM MOVIES
    WHERE {FN Find_Nr_Of_Actors(ID) AS NUMERIC} >= :$NrOfActors
    ORDER BY 1
    INTO :aMovieTitles; :aNrActors
 End SQL



See also 

arithmetic_expression
sql_data_type_name
sql_name

 
PROPERTIES 

Product: 4D
Theme: Syntax rules

 
HISTORY 

 
ARTICLE USAGE

4D SQL Reference ( 4D v16)