Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: eliminate the characters which are not in the specified list of characters
On Jun 15, 2:50 pm, Vijay <avbhaskarre..._at_gmail.com> wrote:
> I want to display the character from the selected list only.
> i want to eliminate the characters which are not in the specified list
> of characters
>
> For expamle...
> Specified list of characters: (a-z 0-9),
>
> my input string is: test for string
> output string should be : testforstring
>
> Please help
>
> Thanks in advance,
> Vijay
See TRANSLATE built-in function. It doesn't support RE-like specifications, but otherwise it does what you want. For your test case, something like this would do:
SQL> SELECT TRANSLATE('test for string','x ','x') FROM SYS.DUAL;
TRANSLATE('TE
This example only removes spaces from the source string.
Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Received on Fri Jun 15 2007 - 07:37:17 CDT