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: 93
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: 64103
Registered: March 2007
Location: Nanterre, France, http://...
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: 93
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: 64103
Registered: March 2007
Location: Nanterre, France, http://...
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: Sat Dec 03 05:38:17 CST 2016

Total time taken to generate the page: 0.11590 seconds