Advertisement
chrissharp123

Untitled

Jul 19th, 2024
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. FOR source_part IN SELECT * FROM biblio.monograph_part WHERE record = source_record LOOP +
  2. +
  3. SELECT INTO target_part * +
  4. FROM biblio.monograph_part +
  5. WHERE label = source_part.label +
  6. AND record = target_record; +
  7. +
  8. -- ... and if there's a conflicting one on the target ... +
  9. IF FOUND THEN +
  10. +
  11. -- ... move the copy-part maps to that, and ... +
  12. UPDATE asset.copy_part_map +
  13. SET part = target_part.id +
  14. WHERE part = source_part.id; +
  15. +
  16. -- ... move P holds to the move-target part +
  17. FOR hold IN SELECT * FROM action.hold_request WHERE target = source_part.id AND hold_type = 'P' LOOP+
  18. +
  19. UPDATE action.hold_request +
  20. SET target = target_part.id +
  21. WHERE id = hold.id; +
  22. +
  23. moved_objects := moved_objects + 1; +
  24. END LOOP; +
  25. +
  26. ???END
  27. -- ... if not ... +
  28. ELSE +
  29. -- ... just move the part to the target record +
  30. UPDATE biblio.monograph_part +
  31. SET record = target_record +
  32. WHERE id = source_part.id; +
  33. END IF; +
  34. +
  35. moved_objects := moved_objects + 1; +
  36. END LOOP;
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement