Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 11 Dec 2008 @ 11:34:50 GMT


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


Subj:   Re: Exception handling for stored procedures and functions
 
From:   David Clough

The irony of all this discussion over Exception handling is that the original Oracle Function didn't actually need the Exception handling code:

     if to_number(substr(v_StrTime,1,2))<5 then
     select to_char(p_Date-1,'D') into v_Day from dual;
     else
     select to_char(p_Date,'D') into v_Day from dual;
     end if;
     RETURN to_number(v_Day);

     exception
     when no_data_found then
     null;
     RETURN -1;

As far as I can tell, you'll always get a row back, thereby negating the need for that block

In terms of Teradata, use a CASE statement - simple as that.

Oh, how I love discussions over Stored Procedures !


Regards

David Clough
Database Developer
Database Design Group



     
  <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