To separate string from email id in SQL you can try below query. seperate 'test' '@' 'xyz' ' com' from test@xyz.com
SELECT
SUBSTR(mailID, 1, INSTR(mailID, '@', 1, 1)-1) String1,
SUBSTR(mailID, INSTR(mailID, '@', 1, 1), 1) String2,
SUBSTR(mailID, INSTR(mailID, '@', 1, 1)+1, INSTR(mailID, '.', 1, 1)-INSTR(mailID, '@', 1, 1)-1) String3,
SUBSTR(mailID, INSTR(mailID, '.', 1, 1)+1) String4
FROM ( SELECT '&MailID' mailID FROM Dual );
SELECT
SUBSTR(mailID, 1, INSTR(mailID, '@', 1, 1)-1) String1,
SUBSTR(mailID, INSTR(mailID, '@', 1, 1), 1) String2,
SUBSTR(mailID, INSTR(mailID, '@', 1, 1)+1, INSTR(mailID, '.', 1, 1)-INSTR(mailID, '@', 1, 1)-1) String3,
SUBSTR(mailID, INSTR(mailID, '.', 1, 1)+1) String4
FROM ( SELECT '&MailID' mailID FROM Dual );
Comments
Post a Comment
Please avoid link comments