2020-02-19 17:05:27 -05:00
|
|
|
UPDATE
|
|
|
|
rlarp.osmfs f
|
|
|
|
SET
|
|
|
|
fspr = gld.fspr
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
N1COMP COMP
|
|
|
|
,N1CCYY FSYRq
|
|
|
|
,KPMAXP PERDS
|
|
|
|
,N1FSPP PERD
|
|
|
|
,to_char(N1FSYP,'FM0000') FSPR
|
|
|
|
,N1SD01 SDAT
|
|
|
|
,N1ED01 EDAT
|
|
|
|
,to_char(N1ED01,'yymm') CAPR
|
|
|
|
,N1ED01 - N1SD01 +1 NDAYS
|
|
|
|
,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR
|
|
|
|
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'00') SSPR
|
|
|
|
FROM
|
|
|
|
LGDAT.GLDATREF
|
|
|
|
INNER JOIN LGDAT.GLDATE ON
|
|
|
|
KPCOMP = N1COMP AND
|
|
|
|
KPCCYY = N1CCYY
|
|
|
|
WHERE
|
|
|
|
N1COMP = 93
|
|
|
|
--AND DIGITS(N1FSYP) = '1901'
|
|
|
|
) gld
|
|
|
|
WHERE
|
2019-03-24 16:03:32 -04:00
|
|
|
f.adj_shipdate BETWEEN gld.sdat AND gld.edat
|