I have a table with a field varchar2 type,
Suppose this values:
aaab
s123
2445
25
21000
2500000
1
10000790
1899
I need to obtain the greater value that begins with 2.
I was trying with:
Select TO_NUMBER(myfield) from Services where myfield like '2%';
I get
2445
25
21000
2500000
Now, I want to obtain, the greater and the smaller values 25
and 2500000
.
I was trying with:
Select TO_NUMBER(myfield) from Services where myfield like '2%' ORDER BY myfield DESC;
and
Select MAX(TO_NUMBER(myfield)) from Services where myfield like '2%';
Select MIN(TO_NUMBER(myfield)) from Services where myfield like '2%';
I get:
01722. 00000 - "invalid number"
*Cause: The specified number was invalid.
*Action: Specify a valid number.