select * from x where data=numeric
Posted in 2005
Topics: SQL Development & Query Writing
HI!
As you can see my problem is already described in the Subject.
I have data in a column table which is unfortunately a char-column.
I trimed the data so that I get only get a part of the column.
e.g. id somedata moredata
1 nothere hi 123 data
2 not hi 34a data
I have a temporary table where I insert parts of the moredata-column.
(Substr and Trim)
the 2nd "column" in moredata should contain only numeric values but as
you can see in row 2 there are some char-data in it.
I thought about a:
select id, substr(trim(moredata), 4,3)) from table wheresubstr(trim(moredata), 4,3)) MATCHES '[1-9]*';
but this does not work out because the data then has to start with a
number but still can have a char in it.
Is there a possibility to do a select statement like i mentioned it in
the subject line?
Greetings
Chris
well i found a solution with:
select * from table where substr(trim(moredata),4,3) NOT MATCHES'*[a-zA-Z+-*]*';
although I don't like the negativ test
if there is the possibility to check if a substr is a numeric let me
know :-)
greetings
chris