Advertisement
cmptrwz

Upgraded magic spell

Jan 13th, 2012
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. DO $$
  2. DECLARE
  3. penalty_row RECORD;
  4. BEGIN
  5. FOR penalty_row IN (
  6. select 'insert into actor.usr_standing_penalty '
  7. || '( org_unit, usr, standing_penalty, staff, set_date, stop_date, note ) '
  8. || 'select org_unit, usr, standing_penalty, staff, set_date, stop_date, note '
  9. || ' from actor.calculate_system_penalties( ' || usr.id || ', ' || ou.id || ' ) ; '
  10. AS penalty_command
  11. from actor.usr usr
  12. join actor.org_unit ou
  13. on ( usr.home_ou = ou.id )
  14. join permission.grp_tree pgt
  15. on ( usr.profile = pgt.id )
  16. where pgt.name = 'Adult' ) LOOP
  17. EXECUTE penalty_row.penalty_command;
  18. END LOOP;
  19. END;$$;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement