cxgn_breedbase
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
store_feature_relationship(integer, integer, integer)
Parameters
Name
Type
Mode
integer
IN
integer
IN
integer
IN
Definition
DECLARE psubj_feature_id ALIAS FOR $1; pobj_feature_id ALIAS FOR $2; ptype_id ALIAS FOR $3; pkeyid INTEGER; BEGIN SELECT INTO pkeyid feature_relationship_id FROM feature_relationship WHERE feature_relationship.subj_feature_id = psubj_feature_id AND feature_relationship.obj_feature_id = pobj_feature_id AND feature_relationship.type_id = ptype_id; IF NOT FOUND THEN INSERT INTO feature_relationship (subj_feature_id, obj_feature_id, type_id) VALUES (psubj_feature_id, pobj_feature_id, ptype_id); RETURN currval('feature_relationship_pk_seq'); END IF; UPDATE feature_relationship SET WHERE feature_relationship.subj_feature_id = psubj_feature_id AND feature_relationship.obj_feature_id = pobj_feature_id AND feature_relationship.type_id = ptype_id RETURN pkeyid; END;