create or replace function ListFind ( target IN varchar2, source IN long, delim IN varchar2 ) RETURN number IS pos number; templist long; x varchar2(2000); BEGIN templist := source; pos:=instr(templist,delim); if (pos = 1) then templist:=substr(templist,pos+1); end if; if (delim = substr(templist,length(templist),1)) then templist:=substr(templist,1,length(templist)-1); end if; x:='GOBABYGO'; while x != 'STOPBABYSTOP' loop x:='STOPBABYSTOP'; pos:=instr(templist,delim); if pos != 0 then if pos != 1 then x:=substr(templist,1,pos-1); end if; templist:=substr(templist,pos+1); else if (length(templist)>0) then x:=templist; templist:=''; end if; end if; if (x = target) then return 1; end if; end loop; return 0; end ListFind; / show errors; grant execute on listfind to public;