| Archives of the TeradataForumMessage Posted: Fri, 01 Apr 2005 @ 14:17:32 GMT
 
 
  
| Subj: |  | Re: Syntax error while creating UDF |  |  |  | From: |  | Geoffrey Rommel |  
 
     > /* tera_stat.c */
     > int tera_stat(vPar1, vPar2)
     > int vPar1;
     > int vPar2;
     > {
     > if (vPar1 == 0.10 * vPar2)
     > {
     > return 1;
     > }
 You can't use the C "return" statement to return a value from your UDF. Instead, the returned value and sqlstate appear as parameters.
All arguments are passed as pointers, and you should be using the data types defined in sqltypes_td.h ... like so: 
     void tera_stat(vPar1, vPar2, result, sqlstate)
     INTEGER * vPar1;
     INTEGER * vPar2;
     INTEGER * result;
     char sqlstate[6];
     {
     if (*vPar1 == 0.10 * (*vPar2))  /* will this work with an integer?? */
     {
     *result = 1;
     } ... etc.
 For more details, see the UDF Programming manual. 
 
 |