Skip to content

Instantly share code, notes, and snippets.

@eight
Created November 21, 2009 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eight/240023 to your computer and use it in GitHub Desktop.
Save eight/240023 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE FUNCTION alnum2han(str in VARCHAR2) RETURN VARCHAR2
/*
全角のアルファベット、数字を半角にする
*/
IS
tmp varchar2(2000);
BEGIN
tmp := translate(
str,
'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
);
RETURN tmp;
END alnum2han;
/
SELECT alnum2han('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz') FROM dual;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment