Example of Table UDF

Connectivity
Teradata Employee

Example of Table UDF

Hello,

Can anyone provide with a sample of a simple table UDF?

Example: A table UDF which returns 2 columns (say col1, col2) of a table (say table1)?

Regards,

Adeel
3 REPLIES
rgs
N/A

Re: Example of Table UDF

Can I suggest that you study the examples in the Teradata documentation: “UDF, UDM and External Stored Procedure Programming”? Look at appendix A in 12.0 or appendix B in 6.2 documentation. The examples are about as simple as one can get for table functions.

rgs
Teradata Employee

Re: Example of Table UDF

I'll give it a try once again, but I wasn't able to compile it (V2R6 example of table function) in first try...thats why asked for a simplest possible example which returns data from a table not from some sort of file.

Regards,

Adeel
rgs
N/A

Re: Example of Table UDF

I would start with the second example “Constant/Variable Mode Table Function”. It is sort of what you are looking for. It takes in a string from a table (or constant) and extracts fields out of it creating a row(s) with three columns for the information it extracted out of the string. That would be a typical usage. That one uses no external file as input.

Other than that, specific comments/questions as to why you can’t make it work would be helpful. Why could you not compile it? What error?