I need to write a bit of SQL which parses the second word of any given string, or if there is no space, the entire string.
The logic is
'XXX YYYYY ZZZZZ' would return YYYY,
'XXX YYY' would return YYY and
'XXXXXX' would return XXXXXX.
Any suggestions? Is there a way of using SUBSTR and the 2 positions within the string? Rather an using the length.
Thanks very much