Sql – Oracle SQL – Parsing a name string and converting it to first initial & last name

informixparsingsqlstring

Does anyone know how to turn this string: "Smith, John R"
Into this string: "jsmith" ?

I need to lowercase everything with lower()
Find where the comma is and track it's integer location value
Get the first character after that comma and put it in front of the string
Then get the entire last name and stick it after the first initial.

Sidenote – instr() function is not compatible with my version

Thanks for any help!

Best Solution

Start by writing your own INSTR function - call it my_instr for example. It will start at char 1 and loop until it finds a ','.

Then use as you would INSTR.

Related Question