1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/noalyss_ynh.git synced 2024-09-03 19:46:20 +02:00
noalyss_ynh/sources/html/admin/sql/patch/upgrade38.sql
2015-09-27 00:54:25 +02:00

28 lines
709 B
PL/PgSQL

begin;
CREATE OR REPLACE FUNCTION find_pcm_type(pp_value "numeric")
RETURNS text AS
$BODY$
declare
str_type text;
str_value text;
n_value numeric;
nLength integer;
begin
str_value:=trim(to_char(pp_value,'99999999999999999999999999999'));
nLength:=length(str_value);
while nLength > 0 loop
n_value:=to_number(str_value,'99999999999999999999999999999');
select p_type into str_type from parm_poste where p_value=n_value;
if FOUND then
return str_type;
end if;
nLength:=nLength-1;
str_value:=substring(str_value from 1 for nLength);
end loop;
return 'CON';
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
update version set val=39;
commit;