TABLE

TABLE takes a table or a query expression and returns a table.

 

TABLE [mfd_root];

 

TABLE CALL executes a query function that is, a CALL to a function that returns a table.

 

TABLE CALL CoordSystems();

 

TABLE CALL SystemGpgpus();

 

TABLE CALL ValueSequence(1, 10, 1);

 

Examples

Within a function:

 

FUNCTION f() TABLE AS (TABLE CALL ValueSequence(0, 10, 2)) END;

SELECT * FROM CALL f();

 

Another use of a function, with TABLE CALL:

 

FUNCTION f(@T TABLE) TABLE AS

  (SELECT Max([Population]) FROM @T) END;

TABLE CALL f([States Table]);

 

The following query works OK because we are passing a parameter @n from the EXECUTE WITH to the TABLE clauses:

 

FUNCTION f(@T TABLE) TABLE AS

  (SELECT Max([Population]) FROM @T) END;

EXECUTE WITH (@n TABLE = CALL f([States Table])) [[ TABLE @n; ]]  ;

 

This query does not work because what is inside the [[  ]] brackets is in a separate execution context that cannot see the function definition that comes before the EXECUTE WITH statement:

 

FUNCTION f(@T TABLE) TABLE AS

  (SELECT Max([Population]) FROM @T) END;

EXECUTE WITH (@n TABLE = [States Table]) [[ TABLE CALL f(@n); ]]  ;

 

If we wanted to use the function, we could define it within the [[  ]] brackets.  This works OK:

 

EXECUTE WITH (@n TABLE = [States Table])  [[

    FUNCTION f(@T TABLE) TABLE AS

      (SELECT Max([Population]) FROM @T) END;

    TABLE CALL f(@n);

]] ;

 

 

See Also

Queries

 

Command Window

 

Query Builder

 

SQL Statements

 

EXECUTE

 

GROUP BY

 

SPLIT

 

TABLE

 

UNION / EXCEPT / INTERSECT

 

VALUE

 

VALUES