Hello All -
Please help with my string ordeals...
Need to separate the alpha:
Alpha =
LastName,FirstName,MiddleName
Data:
SANDERS,JOHNNIE
TORRES,DAISY,C
Results:
LAST_NAME MI FIRST_NAME
SANDERS JOHNNIE
TORES C DAISY
Missing the code for MI & the First should not have the MI
Your help is really appreciated!!!
cristi
Please help with my string ordeals...
Need to separate the alpha:
Alpha =
LastName,FirstName,MiddleName
Data:
SANDERS,JOHNNIE
TORRES,DAISY,C
Results:
LAST_NAME MI FIRST_NAME
SANDERS JOHNNIE
TORES C DAISY
Missing the code for MI & the First should not have the MI
Code:
SUBSTR(alpha,1,CASE
WHEN POSSTR(alpha,',') = 0
THEN LENGTH(RTRIM(alpha))-2
ELSE POSSTR(alpha,',')-1
END )as last_name
,SUBSTR(alpha,CASE
WHEN POSSTR(alpha,',') = 0
THEN LENGTH(RTRIM(alpha))-2
ELSE POSSTR(alpha,',')+1
END,LENGTH(RTRIM(alpha)) ) as first_name
Your help is really appreciated!!!
cristi