Я не понимаю следующий код и описание - PullRequest
0 голосов
/ 16 октября 2019

Это указывает на то, что, возможно, причина того, что у вас нет значений для начала ... в том, что не существует НИКАКОЙ позиции для выставления счетов с указанным «ID» (которую вы заменили «SET ME») для соответствующей работы, полученной из кода стоимости. Ниже добавлено условие, чтобы пропустить те, которые позволяют выполнить запрос ... но согласно выше ... не может быть ничего, что может ссылаться.

begin transaction
--cost code populated, but bill item is NOT.
update clntsteeqpmnt
set clntsteeqpmnt_dflt_jbcstcde_rn=(select jbbllngitm_rn from jbbllngitm where jbbllngitm.jb_rn=jbcstcde.jb_rn and jbbllngitm_id='SET ME')
from clntsteeqpmnt join jbcstcde on clntsteeqpmnt_dflt_jbcstcde_rn=jbcstcde_rn
where clntsteeqpmnt_dflt_jbcstcde_rn<>0 and clntsteeqpmnt_dflt_jbbllngitm_rn=0
and (select jbbllngitm_rn from jbbllngitm where jbbllngitm.jb_rn=jbcstcde.jb_rn and jbbllngitm_id='SET ME') is not null

--bill item populated, but cost code is NOT.
update clntsteeqpmnt
set clntsteeqpmnt_dflt_jbbllngitm_rn=(select jbcstcde_rn from jbcstcde where jbcstcde.jb_rn=jbbllngitm.jb_rn and jbcstcde_id='SET ME')
from clntsteeqpmnt join jbbllngitm on clntsteeqpmnt_dflt_jbbllngitm_rn=jbbllngitm_rn
where clntsteeqpmnt_dflt_jbcstcde_rn=0 and clntsteeqpmnt_dflt_jbbllngitm_rn<>0
and (select jbcstcde_rn from jbcstcde where jbcstcde.jb_rn=jbbllngitm.jb_rn and jbcstcde_id='SET ME') is not null
...