I have following column in the table.
col1
1
a
b
c
2
3
d

and I want to display it as
num chars
1 a
2 b
3 c
4 d

numbers in one column and letters in another column.

Answer Posted / sreenivasulu sangatipalli

SELECT REGEXP_SUBSTR(COL,'[A-B]+',COL) AS COL1,REGEXP_SUBSTR(COL,'[1-9]+',COL) AS COL2 FROM TEST10;
SELECT * FROM (SELECT CASE WHEN REGEXP_LIKE(COL,'[A-Z]+','i') THEN COL END ALPHS,
CASE WHEN REGEXP_LIKE(COL,'[0-9]+') THEN COL END NUMBS
FROM TEST10 ) where ALPHS is not null OR NUMBS is not null;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is clause in sql?

759


Explain what is dbms?

787


What is sql partition function?

801


Explain the difference between sql and mysql.

753


What is data modelling in sql?

712






Does user triggers have entry for trigger with compilation errors?

794


column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.

6594


what is error ora-03113: end-of-file on communication channel?

818


What happens when a trigger is associated to a view?

675


Do we need to create index on primary key?

642


Can we use pl sql in sql server?

739


How do I count duplicates in sql?

756


What is the difference between drop and truncate commands?

704


Why is nosql good?

777


What is difference between procedure and trigger?

673