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
Can I call a procedure inside a function?
What are the popular database management systems in the it industry?
What will you get by the cursor attribute sql%rowcount?
What is a sql schema used for?
How to return an array from java to pl/sql?
what are the advantages and disadvantages of cascading style sheets? : Sql dba
what happens if you no create privilege in a database? : Sql dba
What are different types of indexes?
What is clause?
How do you pronounce sql?
What is pessimistic concurrency control? : Transact sql
what are dynamic queries in t-sql? : Transact sql
how to load data files into tables with 'mysqlimport'? : Sql dba
What is difference between sql and mysql?
What are the usages of sql?