Running the Sample Table UDF in udf_rg_2.cxx

The sample udf_rg_2 is included in a pre-compiled dynamic library called libv4apiex (extension is platform-dependent). Its implementation is in the samples directory in udf_rg_2.cxx.

  1. To declare the table UDF to the server, issue:
    CREATE OR REPLACE PROCEDURE udf_rg_2( IN num INT )
    RESULT( c1 INT )
    EXTERNAL NAME 'udf_rg_2@libv4apiex'
  2. Select rows from the table UDF:
    SELECT * FROM udf_rg_2( 5 );
  3. To see how the describe affects behavior, issue a CREATE PROCEDURE statement that has a different schema than the one published by the table UDF. For example:
    CREATE OR REPLACE PROCEDURE udf_rg_2( IN num INT, IN extra INT )
    RESULT( c1 INT )
    EXTERNAL NAME 'udf_rg_2@libv4apiex'
  4. Select rows from the table UDF:
    SELECT * FROM udf_rg_2( 5 );
    IQ returns an error.