Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Can this be done?

Re: Can this be done?

From: Charlotte Hammond <charlottejanehammond_at_yahoo.com>
Date: Mon, 22 Aug 2005 07:51:25 -0700 (PDT)
Message-ID: <20050822145125.20474.qmail@web33114.mail.mud.yahoo.com>


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_at_frmaint.com>
>> Sent by: oracle-l-bounce_at_freelists.org
>> 22/08/2005 13:03
>> Please respond to BurtonL
>>
>> To: <oracle-l_at_freelists.org>
>> 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  
--
http://www.freelists.org/webpage/oracle-l
Received on Mon Aug 22 2005 - 10:00:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US