case
-- at least two words
when instr(c, ' ', 1, 1) > 0 then
case
-- at least three words
when instr(c, ' ', 1, 2) > 0 then
-- return text between first and last space
substr(
c
, instr(c, ' ', 1, 1)+1
, instr(c, ' ', 1, 2) - instr(c, ' ', 1, 1) - 1
)
else
-- return 2nd word (text after first space)
substr(c, instr(c, ' ', 1, 1)+1)
end
-- one word, return it
else c
end