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

i have some prob lem to tell me about my self in interview first round ...

1704


What is the difference between union and union all command?

555


what is a record in a database ? : Sql dba

566


How do you use collections in procedure to return the resultset?

1788


Explain aggregate functions are available there in sql?

534






Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

531


What is the difference between between and in condition operators?

537


Is left join faster than inner join?

618


What is tuple in sql?

546


Is microsoft sql free?

604


What is union and union all keyword in sql and what are their differences?

577


What are triggers in sql?

582


how can we find the number of rows in a table using mysql? : Sql dba

586


How do you exit in sql?

590


What is sql exception?

517