Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 26 Oct 2006 @ 17:16:45 GMT


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


Subj:   Re: Question about Oracle ROUND() function UDF
 
From:   Curley, David

I know it's often easier that way for users, but must it be in a UDF?

Can your users do something like this in SQL?

     cast(case
       when substr(cast(100.009485 as varchar(18)),length(cast(100.009485 as varchar(18)))) = '5'
       then cast(substr(cast(100.009485 as varchar(18)),1 ,
     length(cast(100.009485 as varchar(18))) -1) || '6' as decimal (11,6))
       else 100.009485
     end  as decimal (11,5))

You'd have to know the original datatype for the CAST in the THEN clause and the destination type for the wrapping CAST, and you'd have to have a big enough VARCHAR to hold the entire number, but it should work OK (at least be a starting point).


Dave



     
  <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