I have a problem in parsing my last name and first name in a table. My code:
SELECT value,
substr(value,instr(value,' ',1),instr(value,' ',2)-2) last_name,
FROM (SELECT 'Matt Ryan, QB' value
FROM dual);
If I write 'Andrew Luck, QB' it parses properly the last name. But when I write 'Matt Ryan, QB' it parses just two letters from the last name. I identify it by white space. I don't understand what can be wrong here.
'Matt Ryan, QB'
'Andrew Luck, QB'