-- -- workflow__delete/1 -- create or replace function workflow__delete( integer ) returns int4 as $$ declare delete_workflow_id alias for $1; rec record; begin -- Delete all cases first for rec in select case_id from workflow_cases where workflow_id = delete_workflow_id loop perform workflow_case_pkg__delete (rec.case_id); end loop; perform acs_object__delete(delete_workflow_id); return 0; end;$$ language plpgsql;