like search on number column in SQL

oracle, sql

Solution

Regardless of which DBMS you are using AND assuming you have a valid reason to do this, you have several ways to solve problems like these. I can think of three right now:

Convert the number to a string and use a LIKE operator on this:

select *
from emp
where to_char(emp_id) like '123%';

Use mathematical operators directly (like Andrey suggests), for example:

select *
from table
where num between 0 and 0.0001;

Construct a mathematical expression (actually, this is just another case of method 2), for example:

select *
from table
where abs(num - round(num, 5)) < 0.00001;

Problem

How do I do a `like` search on a number column in SQL? I want numbers which are `like '0.0000%'`. I tried with ``` select * from emp where emp_id & '' like '123%' select * from emp where CONVERT(varchar(20), emp_id) like '123%' ``` but in vain. Please help me

Original source