Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Can this be done?
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"
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…
-- http://www.freelists.org/webpage/oracle-lReceived on Mon Aug 22 2005 - 10:00:45 CDT