I my DB i want to select data which having A15-A19 using LIKE operator but couldnt get required result.
the code i made as SELECT * FROM MASTER_RULE WHERE VALUE BETWEEN LIKE 'A15%' AND 'A19%'
and also tried regular expression as SELECT * FROM MASTER_RULE WHERE REGEXP_LIKE(value, 'A[1-9]')
. But regexp gives all records not specified range 15-19.
How to achieve the solution for this?
Advertisement
Answer
Your first query is not ok, it has one extra keyword that you do not need.
Here is the regexp_like solution:
SELECT * FROM MASTER_RULE WHERE REGEXP_LIKE(value, '^A[1][5-9]')
UPDATE:
Here is the “BETWEEN SOLUTION”:
SELECT * FROM MASTER_RULE WHERE substr(value, 2,length(value)-1) between 15 AND 19