Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DO $$
- DECLARE
- penalty_row RECORD;
- BEGIN
- FOR penalty_row IN (
- select 'insert into actor.usr_standing_penalty '
- || '( org_unit, usr, standing_penalty, staff, set_date, stop_date, note ) '
- || 'select org_unit, usr, standing_penalty, staff, set_date, stop_date, note '
- || ' from actor.calculate_system_penalties( ' || usr.id || ', ' || ou.id || ' ) ; '
- AS penalty_command
- from actor.usr usr
- join actor.org_unit ou
- on ( usr.home_ou = ou.id )
- join permission.grp_tree pgt
- on ( usr.profile = pgt.id )
- where pgt.name = 'Adult' ) LOOP
- EXECUTE penalty_row.penalty_command;
- END LOOP;
- END;$$;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement