How to split up name

Dear All,
I have a column calles as customer name which contains data like:
akshay singh
vishal kumar jain
shruti jain
Now I need to write a sql query such that my query returns:
akshay
singh
vishal
kumar
jain
shruti
jain
i.e. 1st output-first name,second output-last name
thanks in advance
Message was edited by:
Ballu

may be this? you will have to play arround as per your requirement.
SQL> WITH T AS
  2       (SELECT 'Rob Billy Dev' c
  3          FROM DUAL
  4        UNION ALL
  5        SELECT 'Ballu Mallu Kallu'
  6          FROM DUAL),
  7       t2 AS
  8       (SELECT ' ' || c || ' ' c
  9          FROM T)
10  SELECT DISTINCT SUBSTR (c,
11                          INSTR (c, ' ', 1, LEVEL) + 1,
12                          INSTR (c, ' ', 1, LEVEL + 1) - INSTR (c, ' ', 1, LEVEL) - 1) "String"
13             FROM t2
14       CONNECT BY LEVEL < LENGTH (c) - LENGTH (REPLACE (c, ' ') );
String
Ballu
Billy
Dev
Kallu
Mallu
Rob
6 rows selected.
Elapsed: 00:00:00.00
SQL> WITH T AS
  2    (SELECT 'ROCK ' str FROM dual
  3    UNION ALL
  4    SELECT 'DOCK Dd' FROM dual
  5    UNION ALL
  6    SELECT 'DOCK D Md' FROM dual
  7    UNION ALL
  8    SELECT 'DOCK D M Cdd' FROM dual
  9    )
10  SELECT ( CASE WHEN INSTR(str,' ',1) >0 THEN
11             SUBSTR(str,1,INSTR(str,' ',1))
12         END )first_name,
13          (CASE WHEN    INSTR(str,' ',1,1) >0 THEN
14               SUBSTR(str,INSTR(str,' ',1,1),
15               DECODE(INSTR(str,' ',1,2),0,INSTR(str,' ',1,1),(INSTR(str,' ',1,2)-INSTR(str,' ',1,1)) ))
16          END) middle_name ,
17          (CASE WHEN    INSTR(str,' ',1,2) >0 THEN
18               SUBSTR(str,INSTR(str,' ',1,2),
19                        DECODE(INSTR(str,' ',1,3),0,INSTR(str,' ',1,2),(INSTR(str,' ',1,3)-INSTR(str,' ',1,2)) ))
20           END) Last_name,  
21          (CASE WHEN    INSTR(str,' ',1,3) >0 THEN
22               SUBSTR(str,INSTR(str,' ',1,3),
23                        DECODE(INSTR(str,' ',1,4),0,INSTR(str,' ',1,3),(INSTR(str,' ',1,4)-INSTR(str,' ',1,3)) ))
24           END) Suffix
25    FROM T
26 
SQL> /
FIRST_NAME   MIDDLE_NAME  LAST_NAME    SUFFIX
ROCK
DOCK          Dd
DOCK          D            Md
DOCK          D            M            Cdd
Elapsed: 00:00:00.00
SQL>

Similar Messages

  • How to split 'Full Name' into two columns for 'First' and 'Last' name??

    Any ideas on how to achieve this? http://office.microsoft.com/en-us/excel-help/split-names-by-using-convert-text-t o-columns-HA001149851.aspx

    If:
    A1 = Fistname Lastname
    For firstname:
    (First Name) B1 =SUBSTITUTE($A1," " & $C1, "")
    For the Last name:
    (Last Name) C1 =RIGHT(A1,LEN(A1)-FIND("#",SUBSTITUTE(A1," ","#",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
    If
    A1 = Lastname, Firstname
    (Last Name) B1 =SUBSTITUTE($A1,", " & $C1, "")
    (First Name) C1 =RIGHT($A1,LEN($A1)-FIND("#",SUBSTITUTE($A1," ","#",LEN($A1)-LEN(SUBSTITUTE($A1," ","")))))
    Let me know if you need one that traps multiple commas or middle names.

  • How To Split Large Excel or CSV Files into Smaller Files

    Does anyone know how to split a large Excel or CSV file into multiple smaller files?  Or, is there an app that will work with Mac to do that?

    split [-a suffix_length] [-b byte_count[k|m]] [-l line_count] [-p pattern] [file [name]]
    is a native Terminal command. Read up more on https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man1/split.1.html
    I prefer to use gSplit which is gnu coreutils.
    You can install gnu coreutils using homebrew.

  • How to split the report into different versions view 1 agent delivery

    Hello
    I have a scenario where I need to send a dashboard to multiple users. The user information are stored in the table like the following:
    USER    Day     Car                  Pay Type                    Cost   Email
    USER1
    -10
    -2
    Honda
    Customer Pay
    500
    [email protected]
    USER2
    -4
    -1
    AUDI
    Customer Pay + Warranty
    1000
    [email protected]
    USER2
    -4
    -1
    PORSCHE
    Customer Pay + Warranty
    1000
    [email protected]
    Now I have a dashboard call Car, on this dashboard I have prompts like Date, Car, Pay Type, Cost, pretty much the same name as the columns in the above table. I have also set up session variables to pick up users based on the log in.
    Now for user2, he is getting 1 email, which is the dashboard with both Audi and Porsche on there. Instead, he wants to 2 attachments, 1 for Audi and 1 more Porsche. Is there a way to achieve this using 1 agent?
    Please let me know how to split the result sets based on user records in the table
    Thank you

    Hello,
    Thank You very much for the useful hint.
    Regards
    Aloha

  • How to Split the Date Column in OBIEE

    Hi,
    We have date column name :To_Date and format is MM/DD/YY HH:MM:SS .
    How do split the date into YEARS,MONTH,DAY as new columns.
    kindly help on this.
    Regards.,
    CHR
    Edited by: 867932 on Nov 23, 2011 10:18 PM

    Hi User,
    All 3 functions can be written in rpd too.In BMM layer, duplicate the date column ->Goto Column Mapping tab-> Expression builder ->Select Functions-> Calendar Date/Time Functions-> Select DayofMOnth function. Your logical column's formula will look like,
    DayofMonth(YourDateColumn)
    Rgds,
    Dpka

  • How to split the crystal report records by batch

    Post Author: dhivya
    CA Forum: General
    Im using a Crystal report and i have to split the records to be printed from the application.For Eg: I Generate a report which has about 2000 pages, now i want to print first 500 as one job and then the second job with the other 500 and til 2000 pages.Now i want to know how to split this records..If i use page count and split for first 500 and then how would the second job know that from where it has to continue (How will it take the 501th record).

    Post Author: Charliy
    CA Forum: General
    When I need to do something like that I use the primary sort field as the limiting feature.  For example: if I'm printing a report sorted by Name I'll have parameters for the first letter of the name.  So if the user enters the range A to E, then only names that start with those letters are printed.  The pages wonlt be exactly as if you'd printed the whole report, but it makes in manageable.

  • How To Split Movies for VCD Burning

    Hello:
    I have been trying to figure out how to split movies using QT 7 Pro for a while now, and can't seem to get it. The QT Helpviewer says I can paste the cut portion elsewhere, but it doesn't work. Can someone please help me with this?
    Thanks!
    iMac G4 Flat Panel 700MHz   Mac OS X (10.4.3)  

    This from Apple:
    QuickTime Pro: How to Edit Portions of a Movie
    This document discusses how to edit portions of a QuickTime movie using QuickTime Pro.
    If you have QuickTime Pro, you can use QuickTime Player for basic movie editing. Use the In and Out selection
    markers in QuickTime Player to select a portion of the movie (Figure 1). The darkened area between the two
    markers indicates the selected portion. To fine-tune your selection, click either the In or Out marker to select it,
    then use the arrow keys to move the marker.
    Copy, cut, or delete the selected section (as you would with text in a word processor). When you paste in a
    selection, the new section is added at the position of the playback head.
    To determine the length of the selection:
    1. From the Movie menu, choose Get Movie Properties.
    2. From the right pop-up menu, choose Time.
    To play just the selection:
    1. From the Movie menu, choose Play Selection Only.
    2. Click Play.
    Figure 1 In and Out selection markers
    To split a single movie into multiple movies:
    1. Use the In and Out markers to select part of the movie.
    2. From the Edit menu, choose Copy.
    3. From the File menu, choose New Player.
    4. From the Edit menu, choose Paste.
    5. From the File menu, choose Save.
    6. Type a name and make sure the option to "Make movie self-contained" is selected.
    Repeat the above steps for each movie or clip you want to extract.

  • How to Split/Bend a tabular into 3 parts in a Form?

    Hi Form Experts,
    My questions is how to split a tabular into 3 parts on the canvas.
    Say I have a table like following.
    create table a (
    id number,
    name varchar2(10)
    insert into a values(1,'a');
    insert into a values(2,'b');
    insert into a values(3,'c');
    insert into a values(4,'d');
    insert into a values(5,'e');
    insert into a values(6,'f');
    insert into a values(7,'g');
    insert into a values(8,'h');
    insert into a values(9,'i');
    In a Form, I would like to show 'table a' in a tabular, but it was cut into 3 parts.
    It is like a 3x3 array.
    The first 3 records are displayed on the first column, the middle 3 records are in the 2nd column,the last 3 records are in the last column.
    1,a     4,d     7,g
    2,b     5,e     8,h
    3,c     6,f     9,i
    When I do the execute_query to this Text Item, I can use Key-up and Key-down to scroll the records.
    The reason why I want to make it, just because if the records cannot fit in one screen, I can bend it to the right side.
    Can you guys give me any hints or solutions?
    Appreciate in advance.
    Phil

    I think we have maybe a communication problem.
    I interpreted your question to be how to separate two paragraphs top and bottom, but now it looks more like you want to separate multi-paragraph "sections" into two parts top and bottom, and yo are coorect, what I suggested does not do that.
    What MIGHT work would be to put text frames on the master pages, two on each, one above the other (and these two frames can actually overlap to allow for content of different lengths). The two top frames should have vertical alignment set to top, the lower frames should be set to bottom. Thread the top frame on the left to the bottom frame on the left, then the top frame on the right and the bottom frame on the right.
    If the paragraph style for the first paragraph in any "section" is set to start in next frame you should jump from frame to frame each time you hit a new section, and the there will never be more than two sections on a page, with the maximum gap available (though if there is a particularly long section, you might need to artificially adjust a frame height to create a gap, especially if the frames overlap), no matter how many paragraphs appear in the section:
    The threading here looks confusing. The top frames extend not quite to the bottom, and the lower frames come not quite to the top, so the outport on the upper frame is lower on the page than the inport on the lower frame. I'vew added numbers so you can see the sequence.

  • How to split Windows Vista DVD image?

    I would like to ask how to split windows vista DVD image into specific size using Windows PE Tools Command Prompt.
    Thanks in advanced.

    Hi,
    You can try the following method:
    1.   Install UltraISO and Windows AIK.
    Windows AIK:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=94bb6e34-d890-4932-81a5-5b50c657de08&DisplayLang=en
    2.   Use UltraISO to open the Windows Vista DVD and extract install.wim under the Sources folder to the local hard drive, for example: D:\Vista\sources\install.wim.
    3.   Run Windows PE Tools Command Prompt in elevated mode and type the following command:
    imagex /split D:\vista\sources\install.wim D:\temp\install.swm 380
    Note: D:\vista\sources\install.wim is the name and location of the file which will be split from. D:\temp\install.swm is the name and location of the target file. 380 is each target file size.
    Note: Before doing this, make sure partition D has at least 5GB of free disk space.
    After that, you will get 6 target files named install.swm, install2.swm, install3.swm, install4.swm, install5.swm and install6.swm in D:\temp.
    4.   Use UltraISO to open the Windows Vista DVD. Delete install.wim under the Sources folder and drag install.swm to this folder. Save the whole disk to the local hard drive and we will get CD1.
    5.   Open UltraISO and create a new folder named Sources. Drag install2.swm, install3.swm, install4.swm, install5.swm and install6.swm to the Sources folder. Save install2.swm to the local hard drive and we will get CD2. Use the same method to create CD3, CD4, CD5 and CD6.
    6.   Burn the iso files to CDs.
    The steps above can be a little complex. I recommend obtaining a DVD drive to install Windows Vista.
    Hope it helps.
    Tim Quan - MSFT

  • How get all table name from database

    hi master
    sir
    how get all table name from database

    The big question is 'why'.
    Selecting from view 'dba_tables' will indeed give the list of all tables in the database, but that includes the dictionary tables and the internal tables, and many others that are probably not of interet to a person who needs to ask this question. Besides, the dba_tables view requires access to a DBA account.
    There are several other views: "user_tables" will list all the tables in this user's schema; and "all_tables" will list all the tables this user can access in some way.
    The above do not, of course, include any information about synonyms, sequences, views, indexes and so on.
    The correct answer and the meaningful answer may be two different things.

  • How to split a line item to 2 line item.

    Hi all !
    I have a request, help me please !
    In system I have a invoice with 1 line item value 1000 USD.
    Customer payment 600$. a incoming payment with value 600$ will post to system.
    I want incoming payment and invoice will auto clear 600$ but system can't auto clearing because value is not Identical.
    I want line item of invoice will split to 2 line item. Line item 1 value 600$ and line item 2 value 400$.
    Line item 1 of invoice will auto clear with incoming payment and system will exist a invoice with 1 line item value 400$.
    How to split a line item to 2 line item ? Have FM for split a line item to 2 line item in SAP ?
    If you have other solution for this request, help me please !
    Thanks !

    Hi,
    Have a look at Split line item - Sales Order
    Regards

  • How to configure trex name server

    hi all
      while creating index i am getting the error
    Index could not be created; creating index failed: TREX Name Server (including back-up servers) is down or not accessable. (Errorcode 7217)
    for the above error i need to configure the trex name server using  TREX Configuration in the J2EE Engine  in j2ee visual administrator .
    can any one tell me the clear path that where to configure the above and where j2ee visual administrator installed how to configure the name server
    awaiting for replies
    regards
    ganesh

    Hi Ganesh,
    In order to access the Visual Administrator, go to Start > Programs > SAP J2EE Engine > Visual Administrator. After you login, you will see 2 nodes i.e. Dispatcher and Server. Expand the Server node. Then go to "Services" and expand it. Then go all the way down to "TREX Service". Then on the right hand side, go to the property "nameserver.address" where you will key in "tcpip://<nameserver>:<port>". Then hit "Update" and click on the "Save" button. Then when you go to TRex Monitor, you should be able to see the Name Server running. Hope this helps.
    Thanks,
    Sri
    P.S Please rewards points if you find this helpful. Thanks.

  • How to change the name and description of a wim using DISM

    With Imagex we could update the name and description of the wim with on easy command:
    imagex /info img_file [img_number or
    img_name] [new_name] [new_desc]
    e.g.
    imagex /info Win7Combined.WIM 1 "Win7(x86)" "Windows 7 x86"
    Since the ImageX tool is deprecated in Windows 8 and has been replaced with DISM, can someone explain how to update the name and description with one easy command using DISM like we could with Imagex?

    It looks like this person had the same issue. Have you seen this
    link
    It talks about exporting an Index into a new WIM. Which, in a way, would be renaming it. It's really recreating it and you have to give it a name. But it seems to work.
    Dustin Estes - MCP | www.dustinestes.com

  • How to find the Names of Most costly Views or Most Time consuming views

    Hi All,
    I had a database consisting of almost 200 views,as a part of Optimization process i want to find out the most costlier views.How to do that.Actually i want the names of the VIEWS,so that i can optimize that.Can any one help me out?
    I had one more doubt in our Database a view is created like view A( which is created by joining several tables).so do i need to add index on this view separately or does it take the index of the tables which i joined? And in our Database i  had created
    a VIEW which is derived from other views(the Joining objects are views not tables),so while i select recoreds from this views which is derived from other views it is taking a lot of time.Is tehre any problem with that?

    Please avoid such double post spread over several forums:
    http://social.msdn.microsoft.com/Forums/en-US/bae4042a-10b8-4d12-aa46-88a05ea37a76/how-to-find-the-names-of-most-costly-views-or-most-time-consuming-views?forum=sqldataaccess
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Can someone tell me how to set my name so when I send a text it shows up instead of my phone number

    Can someone tell me how to set my name so when I send a text it shows up instead of my phone number

    You can't do that. Only the sending number is transmitted by the carrier with an SMS message. If the recipient has you in their address book, with most smart phones and some others, the name will display, but that's a function of the phone on the receiving end.

Maybe you are looking for

  • Cant seem to be able to get 802.1x working

    Hi, I have an ESW 520 switch, and one of the reasons I bought this switch is so that I could have some piece of mind about what computers are plugged into the wired network. I was hoping to be able to manage this on the ESW 520, however configuring t

  • Underline in classical report

    HI, Im developing a classical report and want to underline a text which im doing thro sy-uline. However if i take a printout the underline appears as a separate row. Is there any way where i can get pure underline i.e. when taking a printout it will

  • Class- Method Pattern in CodeHints.xml

    I'm creating some custom code hints in the CodeHints.xml and I'm having trouble matching a simple 'Class->Method' pattern. It's the greater than symbol giving me trouble. For example: <menu pattern="$html-" DOCTYPES="PHP_MySQL"> works <menu pattern="

  • Automactic Selection of production Version

    Hi. I have created a material "A" I maintained in material master's MRP4 view selection method "2" I have created two production version with same validity period & same lot size "0001" & "0002" I maintained in order type dependent parameter's master

  • Regarding the datasource

    hai Experts, i have a cube in bw ie bid invitation and bids (in SRM),for that i would like ti find out the datasource in LO ,so wht datasource i should select and do maintainance i have a cube in bw ie Time and Labor (in HR),for that i would like ti