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 are the differences between char and varchar? : Sql dba

517


How do you concatenate in sql?

542


What is foreign key and example?

499


What is the best free sql database?

554


What is the execution plan in sql?

543






What is vector point function?

554


How do I restart sql?

511


What is AUTH_ID and AUTH_USER in pl/sql ?

1679


How does sql profiler work?

561


How insert into statements in sql?

583


What is sql*plus?

560


How to connect a sql*plus session to an oracle server?

612


How is data stored in sql?

543


How can check sql version from command line?

522


how to select unique records from a table? : Sql dba

622