[OPEN-ILS-DEV] Functions for updating the call number label or owning_lib associated with a copy

Ben Ostrowsky ben at esilibrary.com
Thu Apr 14 10:32:59 EDT 2011


On Thu, Apr 14, 2011 at 9:59 AM, Galen Charlton <gmc at esilibrary.com> wrote:

> Hi,
>
> On Apr 14, 2011, at 9:36 AM, Dan Scott wrote:
> > I would probably just bash out something like:
> >
> > UPDATE asset.call_number SET label = 'MYS ' || label
> >  WHERE id IN (
> >    SELECT acn.id
> >      FROM asset.call_number acn
> >        INNER JOIN asset.copy ac ON ac.call_number = acn.id
> >        INNER JOIN asset.copy_location acl ON acl.id = ac.location
> >      WHERE acl.name = 'Mysteries'
> >  ) AND label NOT LIKE 'MYS %';
> > ;
>
> Which is fine as a one-shot; what Ben's proposing is more generally useful.
>

It also avoids uniqueness errors if there's another volume with the same bib
and owner that already has the 'MYS '-prefixed version of the label. That
doesn't come up too often, but one side effect of doing many migrations from
many sources is that any situation which can occur eventually does. :)

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://libmail.georgialibraries.org/pipermail/open-ils-dev/attachments/20110414/f3f7fc12/attachment.htm 


More information about the Open-ils-dev mailing list