trying to split email account into peaces with a select statement
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 .