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
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
What is left join example?
Which data type is a composite type?
What is the benefit of foreign key?
how can we know the number of days between two given dates using mysql? : Sql dba
What are the events on which a database trigger can be based?
How many sql commands are there?
Are views faster than queries?
What is sqlite format?
Can we insert data in view?
How do I view a sql trace file?
What is mutating error?
Which is better varchar or nvarchar?
Should I use mbr or gpt?
List the ways to get the count of records in a table?