You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This SQL will search for call numbers with carriage returns:

SELECT 

ie.instance_hrid,

he.holdings_hrid,

he.holdings_id,

he.call_number

FROM folio_reporting.instance_ext ie

LEFT JOIN folio_reporting.holdings_ext he ON he.instance_id= ie.instance_id

WHERE he.call_number ~ '\n'

;


Building on the query above, this statement will find carriage returns and new line characters and remove them:


with recs as 

(SELECT 

ie.instance_hrid,

he.holdings_hrid,

he.holdings_id,

he.call_number

FROM folio_reporting.instance_ext ie

LEFT JOIN folio_reporting.holdings_ext he ON he.instance_id= ie.instance_id

WHERE he.call_number ~ '\n'

)


SELECT 

recs.call_number,

replace(replace (recs.call_number, chr(13), ''),chr(10),'') as fixed_call_number

FROM recs

;

  • No labels