Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 11 Oct 2004 @ 21:04:17 GMT


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


Subj:   Re: UDF - Overloading inbuilt functions
 
From:   Dennis Calkins

Hi,

you can override any KEYWORD and uses it as an Object ( Database, Table, View, Macro, Function, whatever ) in Teradata if you are Willing to put it in Quotes.

     sel dennis."sum"(column)
         from mytable;

I don't think you will ever be able to call Teradata's internal built in functions.

Can you give a REAL WORLD example of why your UDF would want to call one of the Teradata Built in functions when your UDF could just keep track of the information itself.

The Aggregate Function interface provides all the same functionality as the built in aggregate functions allow.

From the example in the UDF programmers reference manual ( code removed to make it easier to read.

     /* switch to determine the aggregation phase */
     switch (phase)
     {
     case AGR_INIT:
     /* Do Some init stuff */

     /***************************************************/
     /* Fall through to detail phase, because the */
     /* AGR_INIT call passes in the first set of */
     /* values for the group */
     /***************************************************/

     case AGR_DETAIL:
       /* do the detail code */
     break;

     /* This case selection combines the results of ALL */
     /* individual AMPs for each group */
     case AGR_COMBINE:
        /* do the combine stuff */
     break;

     /* This case selection returns the final standard */
     /* deviation. It is called once for each group. */
     case AGR_FINAL:
        /* do the Final stuff */
     break;

     case AGR_NODATA:
        /* NO rows were selected */
     break;

     default:
     /* If it gets here there must be an error because this */
     /* function does not accept any other phase options */
     strcpy(sqlstate, "U0005");
     }


     
  <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: 15 Jun 2023