How do you split a string value in DB2?
For example, given the value:
CHG-FFH.
I want to split on the dash (-), which would resul
I needed to use instr, substr, trim, and messed with locate as well.. but instr, and substr are all supported. You can find a pattern. I had to go through a varchar split with ' - ' and needed to find the end and go back from there.
select itn,
substr(Message, 1 , locate(' - ', Message)) FIRST_SSR,
SUBSTR(Message , instr( message, ' - ', octets)+1, (instr(
message, '(Ref', octets)+1)) SECOND_STR ,
Message
from
(
select p.itn itn,
substr(p.msg, instr( p.msg, ' - ' , octets)+21) Message
from itnpad p
where p.msg like '%MR - Multiple Requests%'
) A