Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Unanswered: Putting initials into the a field?

    Hi ya ALL!!

    I want to strip the first letter of each first name and put it in the INITIALS FIELD? How would I do that?

    Example: The Initials field is blank so I must put it in by taking the first letter of the persons name(s) and put it in that field. So James Dull Reeves initials would be JD. I know if I use this (SUBSTR(Firstnames,1,1) As Intitals) it gives me the first letter of the persons first name but what if he got 2 first names?

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    > what if he got 2 first names?
    How can a person have two "FIRST" names?
    First is First. What comes after first is no longer first.
    Simply establish as business rule & be consistent.
    How do you plan on handling nicknames?

  3. #3
    Join Date
    Jan 2004
    Posts
    7
    Well, let me rather say this....... you have a FirstName field which is you name(s) and then your SurName field. My name is for example Shaun David Turner. FirstName field would take "Shaun David" and SurName field would take Turner.

    My Initials field is empy now I have to fill it in for him, so my initials would be "S D". How do I populate my Initials field with that value?

  4. #4
    Join Date
    Nov 2003
    Location
    Rotterdam, Netherlands
    Posts
    127
    Actually the naming convention in ASIA especially in INDIA is different.

    I understood ur point Shaun
    You just loop thorugh each character Till u encounter a Lower case letter immediately after Upper case letter.
    Keep taking the prev char till this happens.

    Eg: S R Tendulkar
    Loop through till u encounter 'e' and stop.

    hope this helps
    regards

  5. #5
    Join Date
    Nov 2003
    Location
    Rotterdam, Netherlands
    Posts
    127
    OH!! we were updating parallely.
    In your Case First count the number of words by counting Number of Spaces.
    Then loop through the name to extract first character of each name.

    rgds

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    One of my good buddy here is named Rick von Richter;
    where "von" is NOT his middle name & is considered part of his surname.
    Naming conventions vary by geographic/political location.

  7. #7
    Join Date
    Jan 2004
    Posts
    7
    Originally posted by shelva
    OH!! we were updating parallely.
    In your Case First count the number of words by counting Number of Spaces.
    Then loop through the name to extract first character of each name.

    rgds
    thanks for the quick reply!!

    I thought I would do something similar but I need some example because I am not a Oracle GURU!!! :-)
    THANKS!!

  8. #8
    Join Date
    Jan 2004
    Location
    Issy les Moulineaux, France
    Posts
    24
    I don't think ORACLE SQL has a built in function for this.

    Perhaps you can try something like that :

    select replace(translate(initcap(lower(FirstName)),
    'abcdefghijklmnopqrstuvwxyz',
    ' '),' ','')
    from Names;

    You should modify this query for your specific localization.
    Not very pretty, but I think this works.

  9. #9
    Join Date
    Jan 2004
    Posts
    7
    Originally posted by lyonnais
    I don't think ORACLE SQL has a built in function for this.

    Perhaps you can try something like that :

    select replace(translate(initcap(lower(FirstName)),
    'abcdefghijklmnopqrstuvwxyz',
    ' '),' ','')
    from Names;

    You should modify this query for your specific localization.
    Not very pretty, but I think this works.
    THANKS!!

    I must say that you are a junior and you just showed these GURU'S THAT YOU R THE MAN!!!!!!!!!!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •