All Forums Connectivity
Adeel Chaudhry 773 posts Joined 04/08
29 May 2008
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

-- If you are stuck at something .... consider it an opportunity to think anew.
rgs 106 posts Joined 02/07
29 May 2008

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

Adeel Chaudhry 773 posts Joined 04/08
30 May 2008

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

-- If you are stuck at something .... consider it an opportunity to think anew.

rgs 106 posts Joined 02/07
30 May 2008

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?

You must sign in to leave a comment.