aonestar
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_update_rategroup_by_id_json
Parameters
Name
Type
Mode
p_data
jsonb
IN
Definition
declare v_result json; v_msg_text text; v_sqlstate text; v_detail text; v_hint text; v_context text; messages jsonb = $${ "80001": "Not found data" }$$; v_rategroup_id int; v_name text; v_row_count int; begin v_rategroup_id := (p_data ->> 'id')::int; v_name := p_data ->> 'name'; update rate_group set "name" = v_name where id = v_rategroup_id; GET DIAGNOSTICS v_row_count = ROW_COUNT; -- Check if any record was updated if v_row_count > 0 then return fn_result_success(); else return fn_result_error('80001', messages->>'80001'); end if; exception when others then get stacked diagnostics v_msg_text = message_text, v_sqlstate = returned_sqlstate, v_detail = pg_exception_detail, v_hint = pg_exception_hint, v_context = pg_exception_context; return fn_handle_error( v_sqlstate, v_msg_text, v_detail, v_hint, v_context, 'sp_update_rategroup_by_id_json', null ); END;