Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Substr in a loop

user527060Mar 29 2007 — edited Apr 4 2007
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 .
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2007
Added on Mar 29 2007
9 comments
2,181 views