#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    8
    Rep Power
    0

    Create view off split string


    How do i split a string based on a space. And then create a view with three columns of that split string.
    For example if i have a table with Full name as a column how do i split that string and create a view with firstname, middlename, lastname as column names with the split string as data.
    If you need anything clarifying write back.
    Thanks in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,785
    Rep Power
    348
    Originally Posted by markyboy17
    How do i split a string based on a space. And then create a view with three columns of that split string.
    For example if i have a table with Full name as a column how do i split that string and create a view with firstname, middlename, lastname as column names with the split string as data.
    If you need anything clarifying write back.
    Thanks in advance
    Something like:

    Code:
    select regexp_substr(your_column, '[[:alnum:]]+[ ]*', 1, 1) as firstname,
           regexp_substr(your_column, '[[:alnum:]]+[ ]*', 1, 2) as middlename,
           regexp_substr(your_column, '[[:alnum:]]+[ ]*', 1, 2) as lastname
    from your_table

IMN logo majestic logo threadwatch logo seochat tools logo