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

How does join work in sql?

569


What is the purpose of cursors in pl/sql?

656


What is cartesian join in sql?

571


What does the acronym acid stand for in database management?

557


What is 19 null in sql?

549






what is a field in a database ? : Sql dba

557


What is the basic form of sql query?

510


What is file based approach?

503


how to write date and time literals? : Sql dba

546


what is an extent ? : Sql dba

595


What is a natural join?

532


What is rank dense_rank and partition in sql?

551


difference between anonymous blocks and sub-programs.

634


What is difference between inner join and cross join?

534


What is primary key in db?

531