1 CREATE OR REPLACE FUNCTION computecurrentlocation(character varying) RETURNS character varying
2 AS 'select m.currentlocation as computedcurrentlocation
3 from movements_common m,
7 collectionobjects_common c,
10 and r.subjectcsid=h1.name
11 and r.subjectdocumenttype=''Movement''
12 and r.objectdocumenttype=''CollectionObject''
13 and r.objectcsid=h2.name
16 and misc.lifecyclestate <> ''deleted''
17 and m.currentlocation is not null
18 and m.locationdate is not null
20 order by m.locationdate desc,row_number() over(order by locationdate)
24 RETURNS NULL ON NULL INPUT;