25 June 2008

Remove non ASCII Characters from a string

It's simple .....

SQL is here

SELECT
REPLACE(TRANSLATE(UPPER('YOUR_STRING'),
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ,./;''[]\`~!@#$%^\*()__+{}-?><', '0123456789' ), ' ', '') FROM DUAL; Is it useful .. enSoy madi

SP for removing Specail characters

v_nam := replace(v_nam,'''');

v_nam := replace(v_nam,';');

v_nam := utl_i18n.escape_reference(v_nam,'us7ascii');

DECLARE

v_pos1 NUMBER;

v_pos2 NUMBER;

v_pointer NUMBER;

BEGIN

v_pointer :=1;

LOOP

v_pos1:=0;

v_pos2:=0;

v_pos1 :=INSTR(v_nam,'&',v_pointer);

v_pos2 :=INSTR(v_nam,';',v_pointer);

EXIT WHEN v_pointer > 360 OR v_pos1 =0 OR v_pos2 = 0; --Party Name max size is 360; v_nam := SUBSTR(v_nam,1,v_pos1-1)SUBSTR(v_nam,v_pos2+1);

v_pointer:= v_pos2+1;

END LOOP;

END;

1 comment:

Unknown said...

Your article is so informative and I have cleared all of my doubts. Your way of explanation is awesome, thank you for sharing useful information.
Oracle Fusion SCM Training