Home » SQL & PL/SQL » SQL & PL/SQL » SELECT email address and only display username Array? Delimiter?
SELECT email address and only display username Array? Delimiter? [message #272634] Fri, 05 October 2007 14:42 Go to next message
hdogg
Messages: 94
Registered: March 2007
Member
Table Users:
ID,Email, Username, Password


USERNAME@email.com

I want to select the EMAIL field and select only the USERNAME, and put it into Username.

Hence I need to parse the email address and use the @ as the delimiter.

Any Ideas?
Re: SELECT email address and only display username Array? Delimiter? [message #272635 is a reply to message #272634] Fri, 05 October 2007 14:47 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
substr,instr

Regards
Michel
Re: SELECT email address and only display username Array? Delimiter? [message #272641 is a reply to message #272634] Fri, 05 October 2007 14:59 Go to previous messageGo to next message
hdogg
Messages: 94
Registered: March 2007
Member
Thank you!

I went ahead and looked the SUBSTR and INSTR functions up at and found this link:

http://www.psoug.org/reference/substr_instr.html

This is how to return the username:

SELECT SUBSTR('yourname@email.com', 1 ,INSTR('yourname@email.com', '@', 1, 1)-1)
FROM dual;

Re: SELECT email address and only display username Array? Delimiter? [message #272642 is a reply to message #272641] Fri, 05 October 2007 15:05 Go to previous message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Thanks for the feedback.
Michel
Previous Topic: Converting SQL from MSSQL to ORACLE
Next Topic: value returned from a function
Goto Forum:
  


Current Time: Tue Dec 03 12:57:51 CST 2024