Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 20 Nov 2009 @ 15:00:20 GMT


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


Subj:   Re: GUID/UUID generation in UDF
 
From:   Geoffrey Rommel

  1. Is this possible?  


I dare say it is, although I haven't written a UDF like this. The main difficulty here is that you would need to maintain a file in the OS on one of the TPA nodes and then use that file during execution of the UDF. (You might want to keep a copy on all nodes.) Special considerations apply to UDF's that perform I/O, principally the need for an Authorization; see the manuals.

Another challenge is the rate of generating new UUID's. If you only need one number every 30 seconds, reading and writing the file every time is not a big deal. If you need ten numbers every second, reading and writing the file during each call of the UDF would be horribly slow. In that case, you might want to write a Table function that generated a low and high number and assign the numbers from that range within your application.

Another possibility is an external stored procedure, which can be written in C, C++, or Java.

Or maybe you could use a much simpler UDF. Just keep a BIGINT in a table. When you need a new number, add 1 to it; have the UDF convert it to 12 hexadecimal digits; and use those as the last 12 digits of the UUID.

As you can see, I'm just throwing out ideas. Good luck.



     
  <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