1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| CREATE OR REPLACE FUNCTION inseqtotextseq(intseq integer)
RETURNS character varying AS
$BODY$
declare
talphabet char[26]='{"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"}';
r int;
q int;
begin
if intseq<=26 then
raise notice 'intseq %',intseq;
return talphabet[intseq];
else
r=intseq%26;
q=intseq/26;
if r>0 then
return matricule.inseqtotextseq(q)||talphabet[r];
else
if q=1 then
return matricule.inseqtotextseq(q)||talphabet[1];
else
return matricule.inseqtotextseq(q-1)||talphabet[26];
end if;
end if;
end if;
end
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100; |