Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 15 Sep 2004 @ 12:31:48 GMT


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


Subj:   Re: UDF's without using C
 
From:   Dennis Calkins

Hi,

I forgot to mention since this UDF doesn't support NULL input that the "replace function" should probably include

     RETURNS NULL ON  NULL INPUT

so that the amps know not to call this function on NULL input since you can't reverse NULL input and they will simply return NULL back to the user.

If you forget to add that attribute your query will fail if it contains NULL.


     sel d,reverse_str(d) from null_test;
      *** Failure 3604 Cannot place a null value in a NOT NULL field.
                     Statement# 1, Info =0
      *** Total elapsed time was 1 second.


     --------------------- install -----------------

     Replace FUNCTION reverse_str
     (myval VARCHAR(64000))
     RETURNS VARCHAR(64000)
     SPECIFIC reverse_str_v
     LANGUAGE C
     NO SQL
     RETURNS NULL ON  NULL INPUT
     DETERMINISTIC
     EXTERNAL NAME 'CS!reverse_str_v!c:\dennis\udfs\reverse_str.c'
     PARAMETER STYLE TD_GENERAL;


     -----------  example -------------

     sel d,reverse_str(d) from null_test;

      *** Query completed. 2 rows found. 2 columns returned.
      *** Total elapsed time was 1 second.

     d                    reverse_str(d)
     -------------------- ------------------------------------------------------
     dennis               sinned
     ?                    ?


     -------------------------------------------


     
  <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