We can easily find the maximum sub-string from a table of oracle. Let's see the following example..
CREATE table test(
name varchar2(100),
code varchar2(50)
)
INSERT INTO test(name,code) VALUES('Bangladesh','880');
INSERT INTO test(name,code) VALUES('BGD-Mobile','8801');
INSERT INTO test(name,code) VALUES('BGD-GP','88017');
INSERT INTO test(name,code) VALUES('BGD-AKTEL','88018');
INSERT INTO test(name,code) VALUES('BGD-Bangla Link','88019');
INSERT INTO test(name,code) VALUES('BGD-CITYCELL','88011');
INSERT INTO test(name,code) VALUES('BGD-WARID','88016');
INSERT INTO test(name,code) VALUES('BGD-TELETALK','88015');
SELECT * FROM test
SELECT max(code) FROM test WHERE instr('8801234',code)>0;
This will give: 8801
SELECT max(code) FROM test WHERE instr('880234',code)>0;
This will give: 880
SELECT max(code) FROM test WHERE instr('8801123',code)>0;
This will give: 88011
Java J2ME JSP J2EE Servlet Android