-- -- apm__update_parameter/8 -- create or replace function apm__update_parameter( integer, character varying, character varying, character varying, character varying, character varying, integer, integer ) returns varchar as $$ declare update_parameter__parameter_id alias for $1; update_parameter__parameter_name alias for $2; -- default null update_parameter__description alias for $3; -- default null update_parameter__datatype alias for $4; -- default 'string' update_parameter__default_value alias for $5; -- default null update_parameter__section_name alias for $6; -- default null update_parameter__min_n_values alias for $7; -- default 1 update_parameter__max_n_values alias for $8; -- default 1 begin update apm_parameters set parameter_name = coalesce(update_parameter__parameter_name, parameter_name), default_value = coalesce(update_parameter__default_value, default_value), datatype = coalesce(update_parameter__datatype, datatype), description = coalesce(update_parameter__description, description), section_name = coalesce(update_parameter__section_name, section_name), min_n_values = coalesce(update_parameter__min_n_values, min_n_values), max_n_values = coalesce(update_parameter__max_n_values, max_n_values) where parameter_id = update_parameter__parameter_id; update acs_objects set title = (select package_key || ': Parameter ' || parameter_name from apm_parameters where parameter_id = update_parameter__parameter_id) where object_id = update_parameter__parameter_id; return parameter_id; end;$$ language plpgsql;