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 the difference between explicit and implicit cursors in oracle?

517


What is synonyms?

573


How can you load microsoft excel data into oracle? : aql loader

618


What is pragma in sql?

624


How to read/write files from pl/sql?

583






What is normalisation in sql?

553


How many types of cursors supported in pl/sql?

596


What is a trigger word?

516


What is a trigger in sql?

642


When is a declare statement required?

677


what are the advantages a stored procedure? : Sql dba

553


How to return multiple rows from the stored procedure?

524


What is difference between hql and native sql?

585


What is difference between group by and partition by?

499


How many commands are there in sql?

551