While compiling UDF in Teradata, We place the .c program of the function in a folder and compile the function structure in Teradata specifying the file path in the EXTERNAL NAME part.
How do we compile an UDF if we are given the object file (.o extn) of the function only?
Appreciate your help!!
I am not sure if you can do that. It appears you do have .c file, then why do you require to compile using an object file?
In the CREATE (or REPLACE) FUNCTION statement, there is an option EXTERNAL NAME. To compile a UDF with a given object file, specify this option with the suboption CO in the string. As an example, let us assume the following:
Your objective file is called "myudf.o".
The function to use in the source code is called "myudffun(...)"
CREATE FUNCTION ...
EXTERNAL NAME 'CO!myudf!<full_path_to_object_file>/myudf.o!F!myudffun!D!'
In general, you want to compile with the last D suboption when testing, because it enables the debugger.
As a reminder, if you worked with the source file "myudf.c" instead of the object file, then the above suboption would be correspondingly expressed as:
EXTERNAL NAME 'CS!myudf!<full_path_to_object_file>/myudf.c!F!myudffun!D!'
Hope this helps,
Thanks Alexander for the answer and additional info:)
One last question: Is it possible to do a SHOW FUNCTION if function is compiled using .o (object) file.