Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 21 Feb 2007 @ 09:06:59 GMT


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


Subj:   Re: SUBSTR query
 
From:   Barrow, Martin

  Try changing your update so that you first test to make sure that the columns are not equal and that they both contain a '-'. So, your update should look like this:  


          > UPDATE TAB1
          > SET fn_diff = '10'
          > WHERE index (mst_fn, '-') > 0
          > and index (gst_fn, '-') > 0
          > and mst_fn <> gst_fn
          > and substr (mst_fn, 1, index (mst_fn, '-') -1) = substr (gst_fn,
          > (index(gst_fn, '-')) +1) and > substr (gst_fn, 1,
          > index (gst_fn, '-') -1) = substr (mst_fn,(index (mst_fn, '-')) +1);

I've tried the above and it works. Thank you very much, for your help.

Can anyone explain what happened here? Why the Select worked as it was but the Update needed changing to the above?



     
  <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