Posted By

spacebar on 10/14/07


Tagged

character strip function remove Oracle special


Versions (?)

Strip(i.e. remove) special character(s)


 / Published in: SQL
 

  1. /* Strip(remove) special character(s) from a string.
  2.   Parameters -1-: String to process
  3.   -2-: Special character to strip
  4.   Note: If second parameter is null then the following list is used:
  5.   <tab>, <single quote>, <double quote>, <\>, <|>, <`>, <~>, <^>
  6. */
  7. FUNCTION strip_spc_character ( in_string IN varchar2,
  8. in_chars IN varchar2 DEFAULT NULL )
  9. RETURN varchar2
  10. IS
  11. tab char( 1 ) := chr(9);
  12. double_quote char( 1 ) := chr(34);
  13. single_quote char( 1 ) := chr(39);
  14. mask varchar2( 80 ) := '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  15. v_special_chars varchar2( 80 ) := '`~^\|'||double_quote||single_quote||tab;
  16. begin
  17. IF in_chars IS NOT NULL then
  18. v_special_chars := in_chars;
  19. end IF;
  20. RETURN translate( in_string, mask || v_special_chars, mask );
  21. exception
  22. when others then
  23. RETURN in_string;
  24. end strip_spc_character;

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: boydd_uk on June 12, 2009

What SQL is this programmed in, can this be done in Trasact-SQL

Posted By: boydd_uk on June 15, 2009

What SQL is this programmed in, can this be done in Trasact-SQL

Posted By: boydd_uk on June 15, 2009

I'm not sure how to create a window (that is not a window) if you know what I mean. I think this is a very handy way to display street view. So I would like to have a link that opens one of those box things (forgive the technical terms), and display the street view of the coordinates it's given.

You need to login to post a comment.