Name Parser
There was a question asked on InformaticaDevelopement yahoo group about parsing names. I had a piece of code saved from asktom. I don’t know when I got it from asktom, but I know I got it from asktom. I just wanted to put it out here for reference. To parse names you would have to do the following.
SQL>create table name_test ( a varchar2(15) );
Table created.SQL>insert into name_test values ( 'kirtan' );
1 row created.
SQL>insert into name_test values ( 'kirtan desai' );
1 row created.
SQL>insert into name_test values ( 'kirtan desai s' );
1 row created.
SQL>select substr( a||' ', 1, instr(a||' ' ' ')-1 ) first_name,
2 substr( a||' ', instr( a||' ' ' ') +1, instr( a||' ' ' ', 1, 2 )-instr(a||' ' ' ')-1 ) last_name,
3 rtrim(substr( a||' ', instr( a||' ' ' ',1,2)+1),' ') middle_init
4 from name_test
5 /
FIRST_NAME LAST_NAME MIDDLE_INIT
---------------- ----------------- -----------------
kirtan
kirtan desai
kirtan desai s
hope this helps
Kirtan
hope this helpsKirtan
This entry was posted on Wednesday, April 4th, 2007 at 8:56 pm and is filed under Oracle. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.