All Forums Extensibility
EA230039 3 posts Joined 11/09
24 Oct 2013
Call SP,bteq or shell script from a Java or C++ UDF?

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.

Raja_KT 1246 posts Joined 07/09
01 Dec 2013

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



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.







Raja K Thaw
My wiki:
Street Children suffer not by their fault. We can help them if we want.

You must sign in to leave a comment.