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
what are the differences between char and varchar? : Sql dba
How do you concatenate in sql?
What is foreign key and example?
What is the best free sql database?
What is the execution plan in sql?
What is vector point function?
How do I restart sql?
What is AUTH_ID and AUTH_USER in pl/sql ?
How does sql profiler work?
How insert into statements in sql?
What is sql*plus?
How to connect a sql*plus session to an oracle server?
How is data stored in sql?
How can check sql version from command line?
how to select unique records from a table? : Sql dba