Re: mehrfache Leerzeichen in String
geschrieben von:
zaphod (---.ewe-ip-backbone.de)
Datum:
Hallo Carsten,
ich hab's !
und zwar habe ich die Abfrage meiner Tabelle geändert, so dass im Ergebnis schon mal überflüssige Leerzeichen weg sind:
select remove_multispaces(tab_x.langname) as langname
from tab_x
und die where-Bedingung lautet:
where ( instr (remove_multispaces(langname) ,nvl (remove_multispaces(:P3_LANGNAME_SEARCH), remove_multispaces(langname) )) > 0
or (langname is null and :P3_LANGNAME_SEARCH is null) )
Die Funktion erstelle ich als:
create or replace function remove_multispaces(text_in in varchar2) return varchar2 as
repl_text_in varchar2(2000);
begin
repl_text_in:= text_in;
while instr(repl_text_in,'__') >0
loop
repl_text_in:= replace (repl_text_in,'__','_');
end loop;
return (repl_text_in);
end remove_multispaces;
Für das "Highlight" sorgt dann das zusätzliche ITEM :P3_LANGNAME_SEARCH_NOBLANKS.
Dieses ist abgeleitet aus dem Eingabefeld-ITEM :P3_LANGNAME_SEARCH als PL/SQL-Expression or function in der Form - Du ahnst es - remove_multispaces(:P3_LANGNAME_SEARCH).
Das funktioniert alles ganz genau so, wie ich es mir vorstelle.
Vielen Dank noch einmal für Deine Unterstützung und herzliche Grüße,
Zaphod.