Published in: SQL
/* Strip(remove) special character(s) from a string. Parameters -1-: String to process -2-: Special character to strip Note: If second parameter is null then the following list is used: <tab>, <single quote>, <double quote>, <\>, <|>, <`>, <~>, <^> */ FUNCTION strip_spc_character ( in_string IN varchar2, in_chars IN varchar2 DEFAULT NULL ) RETURN varchar2 IS tab char( 1 ) := chr(9); double_quote char( 1 ) := chr(34); single_quote char( 1 ) := chr(39); mask varchar2( 80 ) := '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; v_special_chars varchar2( 80 ) := '`~^\|'||double_quote||single_quote||tab; begin IF in_chars IS NOT NULL then v_special_chars := in_chars; end IF; RETURN translate( in_string, mask || v_special_chars, mask ); exception when others then RETURN in_string; end strip_spc_character;
You need to login to post a comment.
