/**
 * @author Titouan
 * @date 20/05/21
 * @version 1.0.0
 * @project SIEau
 * @table public.codes_sandre
 */

# --- !Ups

create or replace function getSandreLabel(p_champ VARCHAR, p_code INTEGER) returns varchar(50)
language plpgsql
as $$
DECLARE
    v_libelle varchar(50);;
BEGIN
    select coalesce(libelle, '') into v_libelle from codes_sandre where champ = p_champ and code = p_code;;
    return v_libelle;;
END;;
$$ ;

# --- !Downs