Re: Can this be done?

  • From: Charlotte Hammond <charlottejanehammond@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Mon, 22 Aug 2005 07:51:25 -0700 (PDT)

Hi Laura,

Perhaps try something using the CASE statement? For
example:

SELECT CASE
    WHEN SUBSTR (pers_act_rsn_cd, 1, 4) = 'TERM'
             THEN SUBSTR (pers_act_rsn_cd, 7, 1)
    WHEN SUBSTR (pers_act_rsn_cd2, 1, 4) = 'TERM'
             THEN SUBSTR (pers_act_rsn_cd2, 7, 1)
    WHEN SUBSTR (pers_act_rsn_cd3, 1, 4) = 'TERM'
             THEN SUBSTR (pers_act_rsn_cd3, 7, 1)
          ELSE NULL
       END "TERM_CD"
  FROM whatever

Charlotte

>>      "Burton, Laura" <BurtonL@xxxxxxxxxxx>
>>      Sent by: oracle-l-bounce@xxxxxxxxxxxxx
>>      22/08/2005 13:03
>>      Please respond to BurtonL
>>               
>>               To: <oracle-l@xxxxxxxxxxxxx>
>>               cc: 
>>               Subject: Can this be done?


>>I have three fields that I need to use to update 1
>>field.  Can this be done in an insert/select
>>statement?
 
>>Pers_act_rsn_cd
>>Pers_act_rsn_cd2
>>Pers_act_rsn_cd3
 
>>If any of the three contain ?TERM? in the first 4
>>positions then the code from position 7 is to be
>>moved to term_cd.
 
>>Here is my statement so far?
 



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 
--
//www.freelists.org/webpage/oracle-l

Other related posts: