Home » SQL & PL/SQL » SQL & PL/SQL » Auto Generate User Names through particular column (merged by CM) (Oracle 10g)
Auto Generate User Names through particular column (merged by CM) [message #442873] Thu, 11 February 2010 02:02 Go to next message
shahjy
Messages: 3
Registered: February 2010
Location: Karachi
Junior Member

Hi Gurus,

Is there any way / procedure / function through which we can get unique username from its Full Name.

This is not a Database username, its a dummy username for login into any application.

Your suggestions required.

Regards,
Shahzad Yousuf
Re: Auto Generate User Names through particular column [message #442877 is a reply to message #442873] Thu, 11 February 2010 02:07 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Use DBMS_CRYPTO package, for instance HASH procedure.

Regards
Michel

[Updated on: Thu, 11 February 2010 02:07]

Report message to a moderator

Re: Auto Generate User Names through particular column [message #442932 is a reply to message #442877] Thu, 11 February 2010 08:01 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Before rushing off and coding using that hash function Michel suggested, be aware of the fact that the result of a hash is not unique for all different values.
This means that you might end up with two users sharing the same username.
Re: Auto Generate User Names through particular column (merged by CM) [message #442975 is a reply to message #442873] Thu, 11 February 2010 14:32 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
How complex do you want with the user name. Is it just used to make a unique username? if so do

FLLLLSSSSS

Where F is the first character in the first name
L is the first 4 characters in the last name

and S is a number derived from a sequence. You will never have the same username because of the sequence no matter how many john smiths you have.
Re: Auto Generate User Names through particular column (merged by CM) [message #443010 is a reply to message #442975] Fri, 12 February 2010 00:51 Go to previous messageGo to next message
shahjy
Messages: 3
Registered: February 2010
Location: Karachi
Junior Member

Actually, I want to Create using a field that contains user Full Name and i want to generate username like john.smith.

Regards,
Shahzad Yousuf
Re: Auto Generate User Names through particular column (merged by CM) [message #443014 is a reply to message #443010] Fri, 12 February 2010 00:57 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Clear you requirements, explain them in details, post a working Test case: create table and insert statements along with the result you want with these data then we will work with your table and data.

Regards
Michel
Previous Topic: ORA-01006 w/no binded variables
Next Topic: Possible to carry forward information from one record to the next?
Goto Forum:
  


Current Time: Sat Feb 15 15:10:57 CST 2025