2014년 9월 19일 금요일

[MySqL] 국가이름을 반환 하는 function

경고 : DBA 가 아닌 사람이 어쩔수 없이 노가다(?)로 작성한 function 입니다. 그러므로 성능이나 다른 문제가 있을 수도 있습니다.

DELIMITER $$
DROP FUNCTION IF EXISTS FN_GetContryName $$
CREATE FUNCTION FN_GetContryName(country VARCHAR(5)) RETURNS VARCHAR(20)
 BEGIN
     DECLARE result VARCHAR(50);
  
  IF country = 'DEVEL' THEN SET result = '개발';
  -- ISO 3166-1 alpha-2, ISO 3166-1 alpha-3, ISO 3166-1 numeric 을 이용
  ELSEIF country = 'GH' OR country = 'GHA' OR country = '288' THEN SET result = '가나';
  ELSEIF country = 'GA' OR country = 'GAB' OR country = '266' THEN SET result = '가봉';
  ELSEIF country = 'GY' OR country = 'GUY' OR country = '328' THEN SET result = '가이아나';
  ELSEIF country = 'GM' OR country = 'GMB' OR country = '270' THEN SET result = '감비아';
  ELSEIF country = 'GG' OR country = 'GGY' OR country = '831' THEN SET result = '건지 섬';
  ELSEIF country = 'GP' OR country = 'GLP' OR country = '312' THEN SET result = '과들루프';
  ELSEIF country = 'GT' OR country = 'GTM' OR country = '320' THEN SET result = '과테말라';
  ELSEIF country = 'GU' OR country = 'GUM' OR country = '316' THEN SET result = '괌';
  ELSEIF country = 'GD' OR country = 'GRD' OR country = '308' THEN SET result = '그레나다';
  ELSEIF country = 'GR' OR country = 'GRC' OR country = '300' THEN SET result = '그리스';
  ELSEIF country = 'GL' OR country = 'GRL' OR country = '304' THEN SET result = '그린란드';
  ELSEIF country = 'GN' OR country = 'GIN' OR country = '324' THEN SET result = '기니';
  ELSEIF country = 'GW' OR country = 'GNB' OR country = '624' THEN SET result = '기니비사우';
  ELSEIF country = 'NA' OR country = 'NAM' OR country = '516' THEN SET result = '나미비아';
  ELSEIF country = 'NR' OR country = 'NRU' OR country = '520' THEN SET result = '나우루';
  ELSEIF country = 'NG' OR country = 'NGA' OR country = '566' THEN SET result = '나이지리아';
  ELSEIF country = 'AQ' OR country = 'ATA' OR country = '010' THEN SET result = '남극';
  ELSEIF country = 'SS' OR country = 'SSD' OR country = '728' THEN SET result = '남수단';
  ELSEIF country = 'ZA' OR country = 'ZAF' OR country = '710' THEN SET result = '남아프리카 공화국';
  ELSEIF country = 'NL' OR country = 'NLD' OR country = '528' THEN SET result = '네덜란드';
  ELSEIF country = 'AN' OR country = 'ANT' OR country = '530' THEN SET result = '네덜란드령 안틸레스';
  ELSEIF country = 'NP' OR country = 'NPL' OR country = '524' THEN SET result = '네팔';
  ELSEIF country = 'NO' OR country = 'NOR' OR country = '578' THEN SET result = '노르웨이';
  ELSEIF country = 'NF' OR country = 'NFK' OR country = '574' THEN SET result = '노퍽 섬';
  ELSEIF country = 'NC' OR country = 'NCL' OR country = '540' THEN SET result = '누벨칼레도니';
  ELSEIF country = 'NZ' OR country = 'NZL' OR country = '554' THEN SET result = '뉴질랜드';
  ELSEIF country = 'NU' OR country = 'NIU' OR country = '570' THEN SET result = '니우에';
  ELSEIF country = 'NE' OR country = 'NER' OR country = '562' THEN SET result = '니제르';
  ELSEIF country = 'NI' OR country = 'NIC' OR country = '558' THEN SET result = '니카라과';
  ELSEIF country = 'KR' OR country = 'KOR' OR country = '410' THEN SET result = '대한민국';
  ELSEIF country = 'DK' OR country = 'DNK' OR country = '208' THEN SET result = '덴마크';
  ELSEIF country = 'DM' OR country = 'DMA' OR country = '212' THEN SET result = '도미니카 연방';
  ELSEIF country = 'DO' OR country = 'DOM' OR country = '214' THEN SET result = '도미니카 공화국';
  ELSEIF country = 'DE' OR country = 'DEU' OR country = '276' THEN SET result = '독일';
  ELSEIF country = 'TL' OR country = 'TLS' OR country = '626' THEN SET result = '동티모르';
  ELSEIF country = 'LA' OR country = 'LAO' OR country = '418' THEN SET result = '라오스';
  ELSEIF country = 'LR' OR country = 'LBR' OR country = '430' THEN SET result = '라이베리아';
  ELSEIF country = 'LV' OR country = 'LVA' OR country = '428' THEN SET result = '라트비아';
  ELSEIF country = 'RU' OR country = 'RUS' OR country = '643' THEN SET result = '러시아';
  ELSEIF country = 'LB' OR country = 'LBN' OR country = '422' THEN SET result = '레바논';
  ELSEIF country = 'LS' OR country = 'LSO' OR country = '426' THEN SET result = '레소토';
  ELSEIF country = 'RE' OR country = 'REU' OR country = '638' THEN SET result = '레위니옹';
  ELSEIF country = 'RO' OR country = 'ROU' OR country = '642' THEN SET result = '루마니아';
  ELSEIF country = 'LU' OR country = 'LUX' OR country = '442' THEN SET result = '룩셈부르크';
  ELSEIF country = 'RW' OR country = 'RWA' OR country = '646' THEN SET result = '르완다';
  ELSEIF country = 'LY' OR country = 'LBY' OR country = '434' THEN SET result = '리비아';
  ELSEIF country = 'LT' OR country = 'LTU' OR country = '440' THEN SET result = '리투아니아';
  ELSEIF country = 'LI' OR country = 'LIE' OR country = '438' THEN SET result = '리히텐슈타인';
  ELSEIF country = 'MG' OR country = 'MDG' OR country = '450' THEN SET result = '마다가스카르';
  ELSEIF country = 'MQ' OR country = 'MTQ' OR country = '474' THEN SET result = '마르티니크';
  ELSEIF country = 'MH' OR country = 'MHL' OR country = '584' THEN SET result = '마셜 제도';
  ELSEIF country = 'YT' OR country = 'MYT' OR country = '175' THEN SET result = '마요트';
  ELSEIF country = 'MO' OR country = 'MAC' OR country = '446' THEN SET result = '마카오';
  ELSEIF country = 'MK' OR country = 'MKD' OR country = '807' THEN SET result = '마케도니아 공화국';
  ELSEIF country = 'MW' OR country = 'MWI' OR country = '454' THEN SET result = '말라위';
  ELSEIF country = 'MY' OR country = 'MYS' OR country = '458' THEN SET result = '말레이시아';
  ELSEIF country = 'ML' OR country = 'MLI' OR country = '466' THEN SET result = '말리';
  ELSEIF country = 'IM' OR country = 'IMN' OR country = '833' THEN SET result = '맨 섬';
  ELSEIF country = 'MX' OR country = 'MEX' OR country = '484' THEN SET result = '멕시코';
  ELSEIF country = 'MC' OR country = 'MCO' OR country = '492' THEN SET result = '모나코';
  ELSEIF country = 'MA' OR country = 'MAR' OR country = '504' THEN SET result = '모로코';
  ELSEIF country = 'MU' OR country = 'MUS' OR country = '480' THEN SET result = '모리셔스';
  ELSEIF country = 'MR' OR country = 'MRT' OR country = '478' THEN SET result = '모리타니';
  ELSEIF country = 'MZ' OR country = 'MOZ' OR country = '508' THEN SET result = '모잠비크';
  ELSEIF country = 'ME' OR country = 'MNE' OR country = '499' THEN SET result = '몬테네그로';
  ELSEIF country = 'MS' OR country = 'MSR' OR country = '500' THEN SET result = '몬트세랫';
  ELSEIF country = 'MD' OR country = 'MDA' OR country = '498' THEN SET result = '몰도바';
  ELSEIF country = 'MV' OR country = 'MDV' OR country = '462' THEN SET result = '몰디브';
  ELSEIF country = 'MT' OR country = 'MLT' OR country = '470' THEN SET result = '몰타';
  ELSEIF country = 'MN' OR country = 'MNG' OR country = '496' THEN SET result = '몽골';
  ELSEIF country = 'US' OR country = 'USA' OR country = '840' THEN SET result = '미국';
  ELSEIF country = 'UM' OR country = 'UMI' OR country = '581' THEN SET result = '미국령 군소 제도';
  ELSEIF country = 'VI' OR country = 'VIR' OR country = '850' THEN SET result = '미국령 버진아일랜드';
  ELSEIF country = 'MM' OR country = 'MMR' OR country = '104' THEN SET result = '미얀마';
  ELSEIF country = 'FM' OR country = 'FSM' OR country = '583' THEN SET result = '미크로네시아 연방';
  ELSEIF country = 'VU' OR country = 'VUT' OR country = '548' THEN SET result = '바누아투';
  ELSEIF country = 'BH' OR country = 'BHR' OR country = '048' THEN SET result = '바레인';
  ELSEIF country = 'BB' OR country = 'BRB' OR country = '052' THEN SET result = '바베이도스';
  ELSEIF country = 'VA' OR country = 'VAT' OR country = '336' THEN SET result = '바티칸 시국';
  ELSEIF country = 'BS' OR country = 'BHS' OR country = '044' THEN SET result = '바하마';
  ELSEIF country = 'BD' OR country = 'BGD' OR country = '050' THEN SET result = '방글라데시';
  ELSEIF country = 'BM' OR country = 'BMU' OR country = '060' THEN SET result = '버뮤다';
  ELSEIF country = 'BJ' OR country = 'BEN' OR country = '204' THEN SET result = '베냉';
  ELSEIF country = 'VE' OR country = 'VEN' OR country = '862' THEN SET result = '베네수엘라';
  ELSEIF country = 'VN' OR country = 'VNM' OR country = '704' THEN SET result = '베트남';
  ELSEIF country = 'BE' OR country = 'BEL' OR country = '056' THEN SET result = '벨기에';
  ELSEIF country = 'BY' OR country = 'BLR' OR country = '112' THEN SET result = '벨라루스';
  ELSEIF country = 'BZ' OR country = 'BLZ' OR country = '084' THEN SET result = '벨리즈';
  ELSEIF country = 'BA' OR country = 'BIH' OR country = '070' THEN SET result = '보스니아 헤르체고비나';
  ELSEIF country = 'BW' OR country = 'BWA' OR country = '072' THEN SET result = '보츠와나';
  ELSEIF country = 'BO' OR country = 'BOL' OR country = '068' THEN SET result = '볼리비아';
  ELSEIF country = 'BI' OR country = 'BDI' OR country = '108' THEN SET result = '부룬디';
  ELSEIF country = 'BF' OR country = 'BFA' OR country = '854' THEN SET result = '부르키나파소';
  ELSEIF country = 'BV' OR country = 'BVT' OR country = '074' THEN SET result = '부베 섬';
  ELSEIF country = 'BT' OR country = 'BTN' OR country = '064' THEN SET result = '부탄';
  ELSEIF country = 'MP' OR country = 'MNP' OR country = '580' THEN SET result = '북마리아나 제도';
  ELSEIF country = 'BG' OR country = 'BGR' OR country = '100' THEN SET result = '불가리아';
  ELSEIF country = 'BR' OR country = 'BRA' OR country = '076' THEN SET result = '브라질';
  ELSEIF country = 'BN' OR country = 'BRN' OR country = '096' THEN SET result = '브루나이';
  ELSEIF country = 'WS' OR country = 'WSM' OR country = '882' THEN SET result = '사모아';
  ELSEIF country = 'SA' OR country = 'SAU' OR country = '682' THEN SET result = '사우디아라비아';
  ELSEIF country = 'GS' OR country = 'SGS' OR country = '239' THEN SET result = '사우스조지아 사우스샌드위치 제도';
  ELSEIF country = 'SM' OR country = 'SMR' OR country = '674' THEN SET result = '산마리노';
  ELSEIF country = 'ST' OR country = 'STP' OR country = '678' THEN SET result = '상투메 프린시페';
  ELSEIF country = 'PM' OR country = 'SPM' OR country = '666' THEN SET result = '생피에르 미클롱';
  ELSEIF country = 'EH' OR country = 'ESH' OR country = '732' THEN SET result = '서사하라';
  ELSEIF country = 'SN' OR country = 'SEN' OR country = '686' THEN SET result = '세네갈';
  ELSEIF country = 'RS' OR country = 'SRB' OR country = '688' THEN SET result = '세르비아';
  ELSEIF country = 'SC' OR country = 'SYC' OR country = '690' THEN SET result = '세이셸';
  ELSEIF country = 'LC' OR country = 'LCA' OR country = '662' THEN SET result = '세인트루시아';
  ELSEIF country = 'VC' OR country = 'VCT' OR country = '670' THEN SET result = '세인트빈센트 그레나딘';
  ELSEIF country = 'KN' OR country = 'KNA' OR country = '659' THEN SET result = '세인트키츠 네비스';
  ELSEIF country = 'SH' OR country = 'SHN' OR country = '654' THEN SET result = '세인트헬레나';
  ELSEIF country = 'SO' OR country = 'SOM' OR country = '706' THEN SET result = '소말리아';
  ELSEIF country = 'SB' OR country = 'SLB' OR country = '090' THEN SET result = '솔로몬 제도';
  ELSEIF country = 'SD' OR country = 'SDN' OR country = '736' THEN SET result = '수단';
  ELSEIF country = 'SR' OR country = 'SUR' OR country = '740' THEN SET result = '수리남';
  ELSEIF country = 'LK' OR country = 'LKA' OR country = '144' THEN SET result = '스리랑카';
  ELSEIF country = 'SJ' OR country = 'SJM' OR country = '744' THEN SET result = '스발바르 얀마옌';
  ELSEIF country = 'SZ' OR country = 'SWZ' OR country = '748' THEN SET result = '스와질란드';
  ELSEIF country = 'SE' OR country = 'SWE' OR country = '752' THEN SET result = '스웨덴';
  ELSEIF country = 'CH' OR country = 'CHE' OR country = '756' THEN SET result = '스위스';
  ELSEIF country = 'ES' OR country = 'ESP' OR country = '724' THEN SET result = '스페인';
  ELSEIF country = 'SK' OR country = 'SVK' OR country = '703' THEN SET result = '슬로바키아';
  ELSEIF country = 'SI' OR country = 'SVN' OR country = '705' THEN SET result = '슬로베니아';
  ELSEIF country = 'SY' OR country = 'SYR' OR country = '760' THEN SET result = '시리아';
  ELSEIF country = 'SL' OR country = 'SLE' OR country = '694' THEN SET result = '시에라리온';
  ELSEIF country = 'SG' OR country = 'SGP' OR country = '702' THEN SET result = '싱가포르';
  ELSEIF country = 'AE' OR country = 'ARE' OR country = '784' THEN SET result = '아랍에미리트';
  ELSEIF country = 'AW' OR country = 'ABW' OR country = '533' THEN SET result = '아루바';
  ELSEIF country = 'AM' OR country = 'ARM' OR country = '051' THEN SET result = '아르메니아';
  ELSEIF country = 'AR' OR country = 'ARG' OR country = '032' THEN SET result = '아르헨티나';
  ELSEIF country = 'AS' OR country = 'ASM' OR country = '016' THEN SET result = '아메리칸사모아';
  ELSEIF country = 'IS' OR country = 'ISL' OR country = '352' THEN SET result = '아이슬란드';
  ELSEIF country = 'HT' OR country = 'HTI' OR country = '332' THEN SET result = '아이티';
  ELSEIF country = 'IE' OR country = 'IRL' OR country = '372' THEN SET result = '아일랜드';
  ELSEIF country = 'AZ' OR country = 'AZE' OR country = '031' THEN SET result = '아제르바이잔';
  ELSEIF country = 'AF' OR country = 'AFG' OR country = '004' THEN SET result = '아프가니스탄';
  ELSEIF country = 'AD' OR country = 'AND' OR country = '020' THEN SET result = '안도라';
  ELSEIF country = 'AL' OR country = 'ALB' OR country = '008' THEN SET result = '알바니아';
  ELSEIF country = 'DZ' OR country = 'DZA' OR country = '012' THEN SET result = '알제리';
  ELSEIF country = 'AO' OR country = 'AGO' OR country = '024' THEN SET result = '앙골라';
  ELSEIF country = 'AG' OR country = 'ATG' OR country = '028' THEN SET result = '앤티가 바부다';
  ELSEIF country = 'AI' OR country = 'AIA' OR country = '660' THEN SET result = '앵귈라';
  ELSEIF country = 'ER' OR country = 'ERI' OR country = '232' THEN SET result = '에리트레아';
  ELSEIF country = 'EE' OR country = 'EST' OR country = '233' THEN SET result = '에스토니아';
  ELSEIF country = 'EC' OR country = 'ECU' OR country = '218' THEN SET result = '에콰도르';
  ELSEIF country = 'ET' OR country = 'ETH' OR country = '231' THEN SET result = '에티오피아';
  ELSEIF country = 'SV' OR country = 'SLV' OR country = '222' THEN SET result = '엘살바도르';
  ELSEIF country = 'GB' OR country = 'GBR' OR country = '826' THEN SET result = '영국';
  ELSEIF country = 'VG' OR country = 'VGB' OR country = '092' THEN SET result = '영국령 버진아일랜드';
  ELSEIF country = 'IO' OR country = 'IOT' OR country = '086' THEN SET result = '영국령 인도양 지역';
  ELSEIF country = 'YE' OR country = 'YEM' OR country = '887' THEN SET result = '예멘';
  ELSEIF country = 'OM' OR country = 'OMN' OR country = '512' THEN SET result = '오만';
  ELSEIF country = 'AU' OR country = 'AUS' OR country = '036' THEN SET result = '오스트레일리아';
  ELSEIF country = 'AT' OR country = 'AUT' OR country = '040' THEN SET result = '오스트리아';
  ELSEIF country = 'HN' OR country = 'HND' OR country = '340' THEN SET result = '온두라스';
  ELSEIF country = 'AX' OR country = 'ALA' OR country = '248' THEN SET result = '올란드 제도';
  ELSEIF country = 'JO' OR country = 'JOR' OR country = '400' THEN SET result = '요르단';
  ELSEIF country = 'UG' OR country = 'UGA' OR country = '800' THEN SET result = '우간다';
  ELSEIF country = 'UY' OR country = 'URY' OR country = '858' THEN SET result = '우루과이';
  ELSEIF country = 'UZ' OR country = 'UZB' OR country = '860' THEN SET result = '우즈베키스탄';
  ELSEIF country = 'UA' OR country = 'UKR' OR country = '804' THEN SET result = '우크라이나';
  ELSEIF country = 'WF' OR country = 'WLF' OR country = '876' THEN SET result = '왈리스 퓌튀나';
  ELSEIF country = 'IQ' OR country = 'IRQ' OR country = '368' THEN SET result = '이라크';
  ELSEIF country = 'IR' OR country = 'IRN' OR country = '364' THEN SET result = '이란';
  ELSEIF country = 'IL' OR country = 'ISR' OR country = '376' THEN SET result = '이스라엘';
  ELSEIF country = 'EG' OR country = 'EGY' OR country = '818' THEN SET result = '이집트';
  ELSEIF country = 'IT' OR country = 'ITA' OR country = '380' THEN SET result = '이탈리아';
  ELSEIF country = 'ID' OR country = 'IDN' OR country = '360' THEN SET result = '인도네시아';
  ELSEIF country = 'IN' OR country = 'IND' OR country = '356' THEN SET result = '인도';
  ELSEIF country = 'JP' OR country = 'JPN' OR country = '392' THEN SET result = '일본';
  ELSEIF country = 'JM' OR country = 'JAM' OR country = '388' THEN SET result = '자메이카';
  ELSEIF country = 'ZM' OR country = 'ZMB' OR country = '894' THEN SET result = '잠비아';
  ELSEIF country = 'JE' OR country = 'JEY' OR country = '832' THEN SET result = '저지 섬';
  ELSEIF country = 'GQ' OR country = 'GNQ' OR country = '226' THEN SET result = '적도 기니';
  ELSEIF country = 'KP' OR country = 'PRK' OR country = '408' THEN SET result = '조선민주주의인민공화국';
  ELSEIF country = 'GE' OR country = 'GEO' OR country = '268' THEN SET result = '조지아';
  ELSEIF country = 'CF' OR country = 'CAF' OR country = '140' THEN SET result = '중앙아프리카 공화국';
  ELSEIF country = 'TW' OR country = 'TWN' OR country = '158' THEN SET result = '중화민국';
  ELSEIF country = 'CN' OR country = 'CHN' OR country = '156' THEN SET result = '중화인민공화국';
  ELSEIF country = 'DJ' OR country = 'DJI' OR country = '262' THEN SET result = '지부티';
  ELSEIF country = 'GI' OR country = 'GIB' OR country = '292' THEN SET result = '지브롤터';
  ELSEIF country = 'ZW' OR country = 'ZWE' OR country = '716' THEN SET result = '짐바브웨';
  ELSEIF country = 'TD' OR country = 'TCD' OR country = '148' THEN SET result = '차드';
  ELSEIF country = 'CZ' OR country = 'CZE' OR country = '203' THEN SET result = '체코';
  ELSEIF country = 'CL' OR country = 'CHL' OR country = '152' THEN SET result = '칠레';
  ELSEIF country = 'CM' OR country = 'CMR' OR country = '120' THEN SET result = '카메룬';
  ELSEIF country = 'CV' OR country = 'CPV' OR country = '132' THEN SET result = '카보베르데';
  ELSEIF country = 'KZ' OR country = 'KAZ' OR country = '398' THEN SET result = '카자흐스탄';
  ELSEIF country = 'QA' OR country = 'QAT' OR country = '634' THEN SET result = '카타르';
  ELSEIF country = 'KH' OR country = 'KHM' OR country = '116' THEN SET result = '캄보디아';
  ELSEIF country = 'CA' OR country = 'CAN' OR country = '124' THEN SET result = '캐나다';
  ELSEIF country = 'KE' OR country = 'KEN' OR country = '404' THEN SET result = '케냐';
  ELSEIF country = 'KY' OR country = 'CYM' OR country = '136' THEN SET result = '케이맨 제도';
  ELSEIF country = 'KM' OR country = 'COM' OR country = '174' THEN SET result = '코모로';
  ELSEIF country = 'CR' OR country = 'CRI' OR country = '188' THEN SET result = '코스타리카';
  ELSEIF country = 'CC' OR country = 'CCK' OR country = '166' THEN SET result = '코코스 제도';
  ELSEIF country = 'CI' OR country = 'CIV' OR country = '384' THEN SET result = '코트디부아르';
  ELSEIF country = 'CO' OR country = 'COL' OR country = '170' THEN SET result = '콜롬비아';
  ELSEIF country = 'CG' OR country = 'COG' OR country = '178' THEN SET result = '콩고 공화국';
  ELSEIF country = 'CD' OR country = 'COD' OR country = '180' THEN SET result = '콩고 민주 공화국';
  ELSEIF country = 'CU' OR country = 'CUB' OR country = '192' THEN SET result = '쿠바';
  ELSEIF country = 'KW' OR country = 'KWT' OR country = '414' THEN SET result = '쿠웨이트';
  ELSEIF country = 'CK' OR country = 'COK' OR country = '184' THEN SET result = '쿡 제도';
  ELSEIF country = 'HR' OR country = 'HRV' OR country = '191' THEN SET result = '크로아티아';
  ELSEIF country = 'CX' OR country = 'CXR' OR country = '162' THEN SET result = '크리스마스 섬';
  ELSEIF country = 'KG' OR country = 'KGZ' OR country = '417' THEN SET result = '키르기스스탄';
  ELSEIF country = 'KI' OR country = 'KIR' OR country = '296' THEN SET result = '키리바시';
  ELSEIF country = 'CY' OR country = 'CYP' OR country = '196' THEN SET result = '키프로스';
  ELSEIF country = 'TH' OR country = 'THA' OR country = '764' THEN SET result = '타이';
  ELSEIF country = 'TJ' OR country = 'TJK' OR country = '762' THEN SET result = '타지키스탄';
  ELSEIF country = 'TZ' OR country = 'TZA' OR country = '834' THEN SET result = '탄자니아';
  ELSEIF country = 'TC' OR country = 'TCA' OR country = '796' THEN SET result = '터크스 케이커스 제도';
  ELSEIF country = 'TR' OR country = 'TUR' OR country = '792' THEN SET result = '터키';
  ELSEIF country = 'TG' OR country = 'TGO' OR country = '768' THEN SET result = '토고';
  ELSEIF country = 'TK' OR country = 'TKL' OR country = '772' THEN SET result = '토켈라우';
  ELSEIF country = 'TO' OR country = 'TON' OR country = '776' THEN SET result = '통가';
  ELSEIF country = 'TM' OR country = 'TKM' OR country = '795' THEN SET result = '투르크메니스탄';
  ELSEIF country = 'TV' OR country = 'TUV' OR country = '798' THEN SET result = '투발루';
  ELSEIF country = 'TN' OR country = 'TUN' OR country = '788' THEN SET result = '튀니지';
  ELSEIF country = 'TT' OR country = 'TTO' OR country = '780' THEN SET result = '트리니다드 토바고';
  ELSEIF country = 'PA' OR country = 'PAN' OR country = '591' THEN SET result = '파나마';
  ELSEIF country = 'PY' OR country = 'PRY' OR country = '600' THEN SET result = '파라과이';
  ELSEIF country = 'PK' OR country = 'PAK' OR country = '586' THEN SET result = '파키스탄';
  ELSEIF country = 'PG' OR country = 'PNG' OR country = '598' THEN SET result = '파푸아 뉴기니';
  ELSEIF country = 'PW' OR country = 'PLW' OR country = '585' THEN SET result = '팔라우';
  ELSEIF country = 'PS' OR country = 'PSE' OR country = '275' THEN SET result = '팔레스타인';
  ELSEIF country = 'FO' OR country = 'FRO' OR country = '234' THEN SET result = '페로 제도';
  ELSEIF country = 'PE' OR country = 'PER' OR country = '604' THEN SET result = '페루';
  ELSEIF country = 'PT' OR country = 'PRT' OR country = '620' THEN SET result = '포르투갈';
  ELSEIF country = 'FK' OR country = 'FLK' OR country = '238' THEN SET result = '포클랜드 제도';
  ELSEIF country = 'PL' OR country = 'POL' OR country = '616' THEN SET result = '폴란드';
  ELSEIF country = 'PR' OR country = 'PRI' OR country = '630' THEN SET result = '푸에르토리코';
  ELSEIF country = 'FR' OR country = 'FRA' OR country = '250' THEN SET result = '프랑스';
  ELSEIF country = 'GF' OR country = 'GUF' OR country = '254' THEN SET result = '프랑스령 기아나';
  ELSEIF country = 'TF' OR country = 'ATF' OR country = '260' THEN SET result = '프랑스령 폴리네시아';
  ELSEIF country = 'FJ' OR country = 'FJI' OR country = '242' THEN SET result = '피지';
  ELSEIF country = 'FI' OR country = 'FIN' OR country = '246' THEN SET result = '핀란드';
  ELSEIF country = 'PH' OR country = 'PHL' OR country = '608' THEN SET result = '필리핀';
  ELSEIF country = 'PN' OR country = 'PCN' OR country = '612' THEN SET result = '핏케언 제도';
  ELSEIF country = 'HM' OR country = 'HMD' OR country = '334' THEN SET result = '허드 맥도널드 제도';
  ELSEIF country = 'HU' OR country = 'HUN' OR country = '348' THEN SET result = '헝가리';
  ELSEIF country = 'HK' OR country = 'HKG' OR country = '344' THEN SET result = '홍콩';
  ELSE SET result = '알 수 없음';
  END IF;
 
     RETURN result;

 END $$
DELIMITER ;

댓글 없음 :

댓글 쓰기