-- -- notification_request__delete_all/1 -- create or replace function notification_request__delete_all( integer ) returns int4 as $$ declare p_object_id alias for $1; v_request RECORD; begin for v_request in select request_id from notification_requests where object_id= p_object_id loop perform notification_request__delete(v_request.request_id); end loop; return 0; end; $$ language plpgsql;