I have a table tab1 with structure as-
columnName | datatype
col1 | VARCHAR
col2 | VARCHAR
col3 | VARCHAR
col4 | VARCHAR
col5 | VARCHAR
and sample data as
col1 | col2 | col3 | col4 | col5
11 | aaa | aaaa | aaaa | 1111
22 | bbb | bbbb | bbbb | 2a2s
33 | ccc | cccc | ccccc | a312
44 | ddd | dddd | dddd | 4444
Now i want to retrieve only those rows having col5 with only numbers ( like 1st and 4th row). How to write the query in oracle and teradata?
I am not very sure how you represent data like above.
This is what I get:
select * from db1.raja_test1
select * from db1.raja_test1 where trim(id) not between '0' and '9999999999999999'
this will fail for data like '1a1'.
Using a regular expression it's:
WHERE REGEXP_SIMILAR(id, '[0-9]+', 'c')=1
I would like to know more about '[0-9]+' . request you to briefly explain imporntance of + and how does the '[0-9]+' block work.