CREATE OR REPLACE FUNCTION core.get_unit_code_by_unit_id(integer) RETURNS text LANGUAGE plpgsql AS $function$ BEGIN RETURN unit_code FROM core.units WHERE unit_id=$1; END $function$