Hi. I am trying the built-in C functions for ARRAY handling in Teradata 14. Basically, I copied the code below from the FNC_GetArrayElementCount function in the manual TD 14 External Routine Programming:
#define SQL_TEXT Latin_Text #include <sqltypes_td.h> #include <string.h> void MyArrayUDF2( ARRAY_HANDLE *var_ary, INTEGER *result, int *indicator_var_ary, int *indicator_result, char sqlstate[6], SQL_TEXT extname[129], SQL_TEXT specific_name[129], SQL_TEXT error_message[257] ) { int presElementsCount; int lastElement[1]; FNC_GetArrayElementCount((*var_ary),&presElementsCount,lastElement); *result = presElementsCount; return; }
and created the corresponding SQL function:
REPLACE FUNCTION database1.MyArrayUDF2( ARRAY_1 shot_ary ) RETURNS INTEGER NO SQL PARAMETER STYLE SQL DETERMINISTIC LANGUAGE C EXTERNAL NAME 'CS!MyArrayUDF2!MyArrayUDF2.c!F!MyArrayUDF2';
It compiled without warnings, but upon trying the following query:
SELECT MyArrayUDF2(seismic_data.shots);
I get the following error:
*** Failure 7502 A system trap was caused by UDF/XSP/UDM ojt_mnl.MyArrayUDF2 for SIGSEGV
Am I missing any parameter declaration or am I using it incorrectly? I am running this on TD14 in my VM box and I have already checked that ARRAY_HANDLE and FNC_GetArrayElementCount are included on the sqltypes_td.h header file on my vm. Thank you in advance.
Regards,
Maria
Forums: