Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 28 Oct 2009 @ 19:18:38 GMT


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


Subj:   Re: Can functions be nested in views that are used to insert
 
From:   Victor Sokovin

  Can functions be nested in views that are used to insert? I assume not and a macro would be necessary.  


I don't think there is a common understanding of how such views could be used.

If the view uses function y=f(x), where x is a value in the table, then the INSERT should probably be done as x=f**(-1)(y), f**(-1) being the inverse function.

The first problem is that inverse functions are not always well defined. The function you used in the example, y=UPPER(x), does not have a single-value inverse function. It maps 'a' and 'A' to 'A'.

Now, you can get away in your example by applying the same y=f(x) for INSERT, because UPPER() has the property that f(f(x))=f(x) but that's a rather exceptional property. If y=x**2, then f(f(x))=x**4, i.e., the view users will see the fourth power of x.

Perhaps it would be interesting to be able to store a transformation in some database object and use it for INSERTS but regular views don't seem to be good candidates for this.


Victor



     
  <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