Step 1: Create table
CREATE TABLE DELIMETER( NAME VARCHAR2(100 BYTE));
Step 2: Insert data into the column having space delimiter
INSERT INTO DELIMETER (NAME) VALUES ('Elangovan Ragavan')
INSERT INTO DELIMETER (NAME) VALUES ('Dhana Sekaran')
INSERT INTO DELIMETER (NAME) VALUES ('AjithaAngel Anantharaj')
Step 3: Run the below Query to split the name base on space delimiter
/* Formatted on 11/15/2014 11:08:51 AM (QP5 v5.115.810.9015) */
SELECT SUBSTR (NAME, 1, STRING_POS - 1) AS FIRST_NAME,
SUBSTR (NAME, STRING_POS, LENGTH (NAME)) AS LAST_NAME
FROM (SELECT T.NAME, INSTR (T.NAME, ' ') AS STRING_POS
FROM DELIMETER t)
Output:-
CREATE TABLE DELIMETER( NAME VARCHAR2(100 BYTE));
Step 2: Insert data into the column having space delimiter
INSERT INTO DELIMETER (NAME) VALUES ('Elangovan Ragavan')
INSERT INTO DELIMETER (NAME) VALUES ('Dhana Sekaran')
INSERT INTO DELIMETER (NAME) VALUES ('AjithaAngel Anantharaj')
Step 3: Run the below Query to split the name base on space delimiter
/* Formatted on 11/15/2014 11:08:51 AM (QP5 v5.115.810.9015) */
SELECT SUBSTR (NAME, 1, STRING_POS - 1) AS FIRST_NAME,
SUBSTR (NAME, STRING_POS, LENGTH (NAME)) AS LAST_NAME
FROM (SELECT T.NAME, INSTR (T.NAME, ' ') AS STRING_POS
FROM DELIMETER t)
Output:-
FIRST_NAME | LAST_NAME |
Elangovan | Ragavan |
Dhana | Sekaran |
AjithaAngel | Anantharaj |
No comments:
Post a Comment