Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

trying to split email account into peaces with a select statement

Eslam_ElbyalyMar 26 2013 — edited Mar 26 2013
db and dev 10g rel2 , hi all ,
i have a table "emails" with a column "account" with a value "samy@yahoo.com" , and i want exclue this to three columns
"samy" , "yahoo" and "com" as "username" , "website" and "com" respectively .
how to do so with a select statement ?

i thought i could do it with this query :

select substr(account,1,instr(account,'@')-1) ,
substr(account,instr(account,'@')+1,instr(account,'.')-1) , substr(account,instr(account,'.')+1)
from emails


but i got "samy" , "yahoo.co" and "com" instead of "samy" , "yahoo" and "com" , and i do not know why this happens ?

and please demonstrate the solution when post it .
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2013
Added on Mar 26 2013
5 comments
3,249 views