tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ft_vw_tww_damage_update()
Parameters
Name
Type
Mode
IN
Definition
DECLARE BEGIN UPDATE tww_od.damage SET comments = NEW.comments , connection = NEW.connection , fk_dataowner = NEW.fk_dataowner , fk_examination = NEW.fk_examination , fk_provider = NEW.fk_provider , last_modification = NEW.last_modification , line_damage = NEW.line_damage , single_damage_class = NEW.single_damage_class , video_counter = NEW.video_counter , view_parameters = NEW.view_parameters WHERE obj_id = OLD.obj_id; IF OLD.damage_type <> NEW.damage_type THEN RAISE EXCEPTION 'Type change not allowed for damage' USING HINT = 'You cannot switch from ' || OLD.damage_type || ' to ' || NEW.damage_type; END IF; CASE WHEN NEW.damage_type = 'channel'::tww_app.damage_type THEN UPDATE tww_od.damage_channel channel SET obj_id = OLD.obj_id , channel_damage_begin = NEW.channel_damage_begin , channel_damage_code = NEW.channel_damage_code , channel_damage_end = NEW.channel_damage_end , channel_distance = NEW.channel_distance , channel_quantification1 = NEW.channel_quantification1 , channel_quantification2 = NEW.channel_quantification2 WHERE obj_id = OLD.obj_id; WHEN NEW.damage_type = 'manhole'::tww_app.damage_type THEN UPDATE tww_od.damage_manhole manhole SET obj_id = OLD.obj_id , manhole_damage_begin = NEW.manhole_damage_begin , manhole_damage_code = NEW.manhole_damage_code , manhole_damage_end = NEW.manhole_damage_end , manhole_distance = NEW.manhole_distance , manhole_quantification1 = NEW.manhole_quantification1 , manhole_quantification2 = NEW.manhole_quantification2 , manhole_shaft_area = NEW.manhole_shaft_area WHERE obj_id = OLD.obj_id; ELSE NULL; END CASE; RETURN NEW; END;