CREATE FUNCTION "FrValueinWords" (IN "Value" DECIMAL(19,2)) RETURNS VARCHAR(200) COLLATE UNI BEGIN DECLARE decs integer; DECLARE ints integer; DECLARE res varchar(200); SET ints=floor(value); SET res=''; if round(trunc(ints/100000000)) > 0 then if round(trunc(ints/100000000)) > 1 then SET res = res+frdigitvalueinwords(round(trunc(ints/100000000)))+' cents '; else SET res = 'cent '; end if; SET ints=ints-(round(trunc(ints/100000000))*100000000); end if; if round(trunc(ints/1000000)) > 0 then if round(trunc(ints/1000000)) > 1 then SET res = res+frdigitvalueinwords(round(trunc(ints/1000000)))+' millions '; else SET res = res+frdigitvalueinwords(round(trunc(ints/1000000)))+' million '; end if; SET ints=ints-(round(trunc(ints/1000000))*1000000); end if; if round(trunc(ints/100000)) > 0 then if round(trunc(ints/100000)) > 1 then SET res = res+frdigitvalueinwords(round(trunc(ints/100000)))+' cent '; else if res <> '' then SET res = res+'cent '; else SET res='cent '; end if; end if; SET ints=ints-(round(trunc(ints/100000))*100000); end if; if round(trunc(ints/1000)) > 0 then if round(trunc(ints/1000)) > 1 then SET res = res+frdigitvalueinwords(round(trunc(ints/1000)))+' mille '; else if res <> '' then SET res = res+' mille '; else SET res = 'mille '; end if; end if; SET ints=ints-(round(trunc(ints/1000))*1000); end if; if round(trunc(ints/100)) > 0 then if (round(trunc(ints/100)) > 1) and (ints mod 100 = 0) then SET res = res+Frdigitvalueinwords(round(trunc(ints/100)))+' cents '; else SET res = res+'cent '; end if; SET ints=ints-(round(trunc(ints/100))*100); end if; if round(trunc(ints)) > 0 then SET res = res+Frdigitvalueinwords(round(trunc(ints)))+' '; SET ints=ints-(round(trunc(ints/100))*100); end if; if res <> '' then if res = 'un ' then SET res=res+'euro'; else SET res=res+'euros'; end if; end if; SET decs = round((value-floor(value))*100); if decs <> 0 then if res <> '' then SET res = res+' '; end if; if decs=1 then SET res = res+Frdigitvalueinwords(decs)+' cent'; else SET res = res+Frdigitvalueinwords(decs)+' cents'; end if; end if; return res; END CREATE FUNCTION "FrdigitValueinWords" (IN "indecs" INTEGER) RETURNS VARCHAR(200) COLLATE UNI BEGIN declare res varchar(200); declare decs integer; set res=''; set decs=indecs; if decs <> 0 then if round(trunc(decs/10)) in (8,9) then set res= 'quatre-vignts'; set decs=decs-80; end if; if round(trunc(decs/10)) in (6,7) then set res= 'soixante'; set decs=decs-60; end if; if round(trunc(decs/10)) =5 then set res= 'cinquate'; end if; if round(trunc(decs/10))=4 then set res= 'quarante'; end if; if round(trunc(decs/10))=3 then set res= 'trente'; end if; if round(trunc(decs/10))=2 then set res= 'vignt'; end if; if trunc(decs/10) = 1 then if res <> '' then set res = res+'-'; end if; if decs mod 10=1 then set res= res+'onze'; end if; if decs mod 10=2 then set res= res+'douze'; end if; if decs mod 10=3 then set res= res+'treize'; end if; if decs mod 10=4 then set res= res+'quatorze'; end if; if decs mod 10=5 then set res= res+'quinze'; end if; if decs mod 10=6 then set res= res+'seize'; end if; if decs mod 10=7 then set res= res+'dix-sept'; end if; if decs mod 10=8 then set res= res+'dix-huit'; end if; if decs mod 10=9 then set res= res+'dix-neuf'; end if; if decs mod 10=0 then set res= 'dix'; end if; else if decs mod 10=1 then if res <> '' then if decs > 20 then set res = res+' et un'; else set res = res+'-un'; end if; else set res = 'un'; end if; else if res <> '' then set res=res+'-'; end if; end if; if decs mod 10=2 then set res= res+'deux'; end if; if decs mod 10=3 then set res= res+'trois'; end if; if decs mod 10=4 then set res= res+'quatre'; end if; if decs mod 10=5 then set res= res+'cinq'; end if; if decs mod 10=6 then set res= res+'six'; end if; if decs mod 10=7 then set res= res+'sept'; end if; if decs mod 10=8 then set res= res+'huit'; end if; if decs mod 10=9 then set res= res+'neuf'; end if; end if; end if; return res; END CREATE FUNCTION "digitValueinWords" (IN "decs" INTEGER) RETURNS VARCHAR(200) COLLATE UNI BEGIN declare res varchar(200); set res=''; if decs <> 0 then if round(trunc(decs/10))=9 then set res= 'ninety'; end if; if round(trunc(decs/10))=8 then set res= 'eighty'; end if; if round(trunc(decs/10))=7 then set res= 'seventy'; end if; if round(trunc(decs/10))=6 then set res= 'sixty'; end if; if round(trunc(decs/10)) =5 then set res= 'fifty'; end if; if round(trunc(decs/10))=4 then set res= 'fourty'; end if; if round(trunc(decs/10))=3 then set res= 'thirty'; end if; if round(trunc(decs/10))=2 then set res= 'twenty'; end if; if trunc(decs/10)=1 then if decs mod 10=1 then set res= 'eleven'; end if; if decs mod 10=2 then set res= 'twelve'; end if; if decs mod 10=3 then set res= 'thirteen'; end if; if decs mod 10=4 then set res= 'fourteen'; end if; if decs mod 10=5 then set res= 'fifteen'; end if; if decs mod 10=6 then set res= 'sixteen'; end if; if decs mod 10=7 then set res= 'seventeen'; end if; if decs mod 10=8 then set res= 'eighteen'; end if; if decs mod 10=9 then set res= 'eighteen'; end if; if decs mod 10=0 then set res= 'ten'; end if; else if (decs mod 10 <> 0) and (RES <> '') then set res=res+'-'; end if; if decs mod 10=1 then set res= res+'one'; end if; if decs mod 10=2 then set res= res+'two'; end if; if decs mod 10=3 then set res= res+'three'; end if; if decs mod 10=4 then set res= res+'four'; end if; if decs mod 10=5 then set res= res+'five'; end if; if decs mod 10=6 then set res= res+'six'; end if; if decs mod 10=7 then set res= res+'seven'; end if; if decs mod 10=8 then set res= res+'eight'; end if; if decs mod 10=9 then set res= res+'nine'; end if; end if; end if; return res; END CREATE FUNCTION "ValueinWords" (IN "Value" DECIMAL(19,2)) RETURNS VARCHAR(200) COLLATE UNI BEGIN declare decs integer; declare ints integer; declare res varchar(200); set ints=floor(value); set res=''; if round(trunc(ints/100000000)) > 0 then set res = digitvalueinwords(round(trunc(ints/100000000)))+' hundred '; set ints=ints-(round(trunc(ints/100000000))*100000000); end if; if round(trunc(ints/1000000)) > 0 then if res <> '' then set res = res+'and '; end if; set res = res+digitvalueinwords(round(trunc(ints/1000000)))+' million '; set ints=ints-(round(trunc(ints/1000000))*1000000); end if; if round(trunc(ints/100000)) > 0 then set res = res+digitvalueinwords(round(trunc(ints/100000)))+' hundred '; set ints=ints-(round(trunc(ints/100000))*100000); end if; if round(trunc(ints/1000)) > 0 then if res <> '' then set res = res+'and '; end if; set res = res+digitvalueinwords(round(trunc(ints/1000)))+' thousand '; set ints=ints-(round(trunc(ints/1000))*1000); end if; if round(trunc(ints/100)) > 0 then set res = res+digitvalueinwords(round(trunc(ints/100)))+' hundred '; set ints=ints-(round(trunc(ints/100))*100); end if; if round(trunc(ints)) > 0 then if res <> '' then set res = res+'and '; end if; set res = res+digitvalueinwords(round(trunc(ints)))+' '; set ints=ints-(round(trunc(ints/100))*100); end if; if res <> '' then if res = 'one ' then set res=res+'dollar'; else set res=res+'dollars'; end if; end if; set decs = round((value-floor(value))*100); if decs <> 0 then if res <> '' then set res = res+' and '; end if; set res = res+digitvalueinwords(decs)+' cents'; end if; return res; END