Substr in a loop
I have a table with records
create table record( col1 varchar2(20));
insert into table values ('ABCD1234');
insert into table values ('ABCD123');
insert into table values ('ABCD12');
insert into table values ('ABCDE');
ABCD1234
ABCD123
ABCD12
ABCDE.
I have an incoming record ABCD123ABC (passed as a parameter to fun/proc)
I want to write a function/procedure to use the substr function in a loop so that when I match incoming record "ABCD123ABC" to the list in the table. it should find me the exact match. If it does not match then it should substr it to ABCD123AB and start searching, if no match then substr to ABCD123A and search, if no macth then substr to ABCD123. once matched, I want the record .