The easiest way to do this is substr and then using instr for th position…
-
For first name - the instr finds the position of the space, and then the substr extracts from the first character to the space.
-
For last name - the instr finds the position of the space, and then the substr extracts from the space to the last character.
Here is an example…
select
substr(‘Joe Smoe’,1,instr( ‘Joe
Smoe’,’ ',1))
first_name,
substr(‘Joe Smoe’,instr( ‘Joe
Smoe’,’ ',1)+1)
last_name
from dual;
From: hani.chahelli [mailto:bounce-hanichahelli@toadworld.com]
Sent: Wednesday, June 26, 2013 12:14 PM
Subject: [Toad for Oracle - Discussion Forum] Decode Function?
Thread created by hani.chahelli
I have a field that has full name, trying to figure out the best way (easiest) to de-concatenate the field to first name saved to a new field and last name saved
to another…any thoughts?
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.