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
how to use regular expression in pattern match conditions? : Sql dba
What are different categories of sql commands?
How to fetch values from testtable1 that are not in testtable2 without using not keyword?
How to create your own reports in sql developer?
1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...
What is raw datatype in sql?
How do you optimize a query?
How do you modify a column in sql?
what is single byte over head in oracle..?
Mention what does plv msg allows you to do?
What is partition in sql query?
Does sap use sql?
how to shutdown mysql server? : Sql dba
how to drop an existing view in mysql? : Sql dba
How to display the records between two range in Oracle SQL Plus?