Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 07 Oct 2004 @ 13:15:47 GMT


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


Subj:   UDF - Overloading inbuilt functions
 
From:   Narayan Murthy

Is it possible to overload the inbuilt functions like SUM, MAX .etc giving these functions a different behavior.

     Say SUM(col1, positive)
         SUM(col1, even)

I know I can achieve the above by tweaking the WHERE clause OR giving a different name to the function like SUMOFPOSITIVE/SUMOFEVEN but the question is can these inbuilt functions be overloaded.

In the same context would it be possible to have a UDF which would do something like:

     Function SUM (column, flag, behavior)
     If flag = default // i.e. invoke inbuilt sum
             Return SUM(column)
     Else
             // Return based on the behavior - say SUM of positives/even numbers

Narayan



     
  <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