Call SP,bteq or shell script from a Java or C++ UDF?

Extensibility
Teradata Employee

Call SP,bteq or shell script from a Java or C++ UDF?

Hi,

Can I call an SP, run a bteq or shellscript from inside a UDF?

I'm currently working at a migration project from Oracle to TD, and they have some operational reports that are called from the Publisher of OBIEE through Oracle Function Tables, something like this:

- The user log from Web application and executes the report

- The SQL executed is like : Select * from Function_Table(Parameters).

Inside the function_table code, there is: SQL code of the report, the export of the result set to a flat file, the compression of the file, and a email to the user saying that the report is done and the location of the file.

So, I was thinking in doing in TD something like: Select UDF(Parameters)

Where the UDF call a bteq or shellscript that does all the same as the Oracle Function Table.

Thanks!

Esteban

1 REPLY

Re: Call SP,bteq or shell script from a Java or C++ UDF?

Hi,

In c,c++, you need to have your specific header files and check them before implementing like example:

#include <stddef.h>,#include <stdlib.h>,#include <stdio.h> . If you dont have the connectivity then you have to make one header file.

Also, you can have external stored proc in bteq:

create procedure abc

(p1,p2)

language CPP NO SQL PARAMETER STYLE TD_GENERAL

EXTERNAL NAME 'CS!abc!cplusplus.cpp';

Similarly in Java, also you can call a connection through methods. I guess there are packages that you may need to import.

Yes from bteq you can  execute unix script. I dont remember  calling shell script from c,c++ or Java. I think it should be  very much possible, but you need to make header files or packages. It takes a lot of doing and also time.

Try the above.

Cheers,

Raja