Ich häng mich mal hier rein, es funzt nicht ...
PHP-Code:
update TEMP#B/FILE XX
set (BEZ, WERT) =
(select coalesce(substr(a.INHACD, 01, 30), '*fehlt'),
coalesce(substr(b.INHACD, 24, 22), '*fehlt')
from CBUCHP a left outer join CBUCHP b
on a.FINR=b.FINR and a.SART=b.SART
and a.SPRC=b.SPRC and a.SAKZ=b.SAKZ
and substr(a.RKEY, 1, 2)=substr(b.RKEY, 1, 2)
and ' 01 ' =substr(b.RKEY, 3, 4)
where a.SART='ABCD ' and a.SAKZ='6'
and substr(a.RKEY, 1, 2)=digits(XX.BANK)
and substr(a.RKEY, 3) = ' ')
Wenn in CBUCH der Eintrag für eine Bank mit rkey 'bb ' fehlt (Banknr, rest Blank --> letzte substr)
bricht er ab mit "Nullwerte für Spalte oder Variable BEZ nicht zulässig".
Erwartet hätte ich '*fehlt' in dem Testsatz
Bookmarks