Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 01 Apr 2005 @ 14:17:32 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


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.



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 23 Jun 2019