Oracle trigger pl/sql errors - sql
Here is a trigger I want to create on one of my tables that should move certaint data from 3 tables to 4th table either via update or insert depending if it exists or not. Here is what I came up with so far.
CREATE or REPLACE TRIGGER UMELD_PWEL_TRIG
AFTER INSERT OR UPDATE ON USCADM.USC_UMELD
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW WHEN (NEW.PWEL_STAT = 1)
DECLARE
ILOSC INT;
BEGIN
select count(*) INTO ILOSC from USCADM.USC_PESELU where RK = :NEW.RK AND DZ = :NEW.DZ AND NR = :NEW.NR AND NRP = :NEW.NRP AND IDUSC = :NEW.IDUSC;
if ILOSC = 1 then
update PESEL set PESEL.IDUSC = ODPSKR.IDUSC, PESEL.RK = ODPSKR.RK, PESEL.DZ = ODPSKR.DZ, PESEL.NR = ODPSKR.NR, PESEL.NRP = ODPSKR.NRP, PESEL.DZPL = ODPSKR.DZPL,
PESEL.NRO = ODPSKR.NRO, PESEL.NAZWPL = ODPSKR.NAZWPL, PESEL.NAZW = ODPSKR.NAZW, PESEL.IMIE1PL = ODPSKR.IMIE1PL, PESEL.IMIE1 = ODPSKR.IMIE1, PESEL.IMIER = ODPSKR.IMIER,
PESEL.UR_DATAR = ODPSKR.UR_DATAR, PESEL.UR_DATAM = ODPSKR.UR_DATAM, PESEL.UR_DATAD = ODPSKR.UR_DATAD, PESEL.UR_MSC = ODPSKR.UR_MSC, PESEL.IDUR_MSC = ODPSKR.IDUR_MSC,
PESEL.KTUR_MSC = USCADM.fnNrStatToTeryt(ODPSKR.IDUR_MSC), PESEL.UR_KRAJ = ODPSKR.UR_KRAJ, PESEL.OJ_NAZW = ODPSKR.OJ_NAZW, PESEL.OJ_NAZWR = ODPSKR.OJ_NAZWR,
PESEL.OJ_IMIE1 = ODPSKR.OJ_IMIE1, PESEL.OJ_IMIER = ODPSKR.OJ_IMIER, PESEL.MA_NAZW = ODPSKR.MA_NAZW, PESEL.MA_NAZWRPL = ODPSKR.MA_NAZWRPL, PESEL.MA_NAZWR = ODPSKR.MA_NAZWR,
PESEL.MA_IMIE1 = ODPSKR.MA_IMIE1, PESEL.MA_IMIER = ODPSKR.MA_IMIER, PESEL.PESEL = MELD.PESEL, PESEL.A_MSC = MELD.A_MSC, PESEL.IDA_MSC = MELD.IDA_MSC,
PESEL.KRA_MSC = USCADM.fnNrStatToTeryt(MELD.IDA_MSC), PESEL.A_MSC_KP = MELD.A_MSC_KP, PESEL.A_ULICA = MELD.A_ULICA, PESEL.A_DOM = MELD.A_DOM, PESEL.A_LOKAL = MELD.A_LOKAL,
PESEL.A_KRAJ = MELD.A_KRAJ, PESEL.TYP_ADR = MELD.TYP_ADR, PESEL.MPESEL = MELD.MPESEL, PESEL.OPESEL = MELD.OPESEL, PESEL.M_DOW_TYP = MELD.M_DOW_TYP, PESEL.M_DOW_NR = MELD.M_DOW_NR,
PESEL.M_DOW_WYD = MELD.M_DOW_WYD, PESEL.M_DOW_MSC = MELD.M_DOW_MSC, PESEL.IDM_DOW_MSC = MELD.IDM_DOW_MSC, PESEL.M_DOW_DATAR = MELD.M_DOW_DATAR, PESEL.M_DOW_DATAM = MELD.M_DOW_DATAM,
PESEL.M_DOW_DATAD = MELD.M_DOW_DATAD, PESEL.M_DOW_KRAJ = MELD.M_DOW_KRAJ, PESEL.O_DOW_TYP = MELD.O_DOW_TYP, PESEL.O_DOW_NR = MELD.O_DOW_NR, PESEL.O_DOW_WYD = MELD.O_DOW_WYD,
PESEL.O_DOW_MSC = MELD.O_DOW_MSC, PESEL.IDO_DOW_MSC = MELD.IDO_DOW_MSC, PESEL.O_DOW_DATAR = MELD.O_DOW_DATAR, PESEL.O_DOW_DATAM = MELD.O_DOW_DATAM, PESEL.O_DOW_DATAD = MELD.O_DOW_DATAD,
PESEL.O_DOW_KRAJ = MELD.O_DOW_KRAJ, PESEL.PLEC = ODPSKR.PLEC, PESEL.WA_DATAR = AKT.WA_DATAR, PESEL.WA_DATAM = AKT.WA_DATAM, PESEL.WA_DATAD = AKT.WA_DATAD, PESEL.ODP_KTO = ODPSKR.IDMR_KTO,
PESEL.ODP_KIEDY = ODPSKR.IDMR_KIEDYS, PESEL.MEL_KTO = MELD.IDMR_KTO, PESEL.MEL_KIEDY = ODPSKR.IDMR_KIEDYS, PESEL.ZD_DATAR = ODPSKR.ZD_DATAR, PESEL.ZD_DATAM = ODPSKR.ZD_DATAM,
PESEL.ZD_DATAD = ODPSKR.ZD_DATAD, PESEL.ZD_UPR_DATAR = ODPSKR.ZD_UPR_DATAR, PESEL.ZD_UPR_DATAM = ODPSKR.ZD_UPR_DATAM, PESEL.ZD_UPR_DATAD = ODPSKR.ZD_UPR_DATAD, PESEL.ZD_N = ODPSKR.ZD_N,
PESEL.ZD_KOD = ODPSKR.ZD_KOD, PESEL.ZD_DOK = ODPSKR.ZD_DOK, PESEL.ZD_ORG = ODPSKR.ZD_ORG, PESEL.ZD_ORG_OPIS = ODPSKR.ZD_ORG_OPIS, PESEL.ZD_MSC = ODPSKR.ZD_MSC, PESEL.IDZD_MSC = ODPSKR.IDZD_MSC,
PESEL.AKT_KIEDY = AKT.IDMR_KIEDYS
from USCADM.USC_UODPSKR as ODPSKR
join USCADM.USC_UMELD as MELD on ODPSKR.RK = MELD.RK AND ODPSKR.DZ = MELD.DZ AND ODPSKR.NR = MELD.NR AND ODPSKR.NRP = MELD.NRP AND ODPSKR.IDUSC = MELD.IDUSC
join USCADM.USC_UAKT as AKT on ODPSKR.RK = AKT.RK AND ODPSKR.DZ = AKT.DZ AND ODPSKR.NR = AKT.NR AND ODPSKR.NRP = AKT.NRP AND ODPSKR.IDUSC = AKT.IDUSC
join USCADM.USC_PESELU as PESEL on ODPSKR.RK = PESEL.RK AND ODPSKR.DZ = PESEL.DZ AND ODPSKR.NR = PESEL.NR AND ODPSKR.NRP = PESEL.NRP AND ODPSKR.IDUSC = PESEL.IDUSC
WHERE ODPSKR.RK = :NEW.RK AND ODPSKR.DZ = :NEW.DZ AND ODPSKR.NR = :NEW.NR AND ODPSKR.NRP = :NEW.NRP AND ODPSKR.IDUSC = :NEW.IDUSC;
elsif ILOSC = 0 then
insert into USCADM.USC_PESELU (IDUSC, RK, DZ, NR, NRP, DZPL, NRO, NAZWPL, NAZW, IMIE1PL, IMIE1, IMIER, UR_DATAR, UR_DATAM, UR_DATAD, UR_MSC, IDUR_MSC, KTUR_MSC,PESEL.UR_KRAJ,
OJ_NAZW, OJ_NAZWR, OJ_IMIE1, OJ_IMIER, MA_NAZW, MA_NAZWRPL, MA_NAZWR, MA_IMIE1, MA_IMIER, PESEL, A_MSC, IDA_MSC, KRA_MSC, A_MSC_KP, A_ULICA, A_DOM, A_LOKAL,
A_KRAJ, TYP_ADR,MPESEL,OPESEL,M_DOW_TYP,M_DOW_NR, M_DOW_WYD, M_DOW_MSC, IDM_DOW_MSC, M_DOW_DATAR,M_DOW_DATAM, M_DOW_DATAD, M_DOW_KRAJ, O_DOW_TYP, O_DOW_NR, O_DOW_WYD,O_DOW_MSC,
IDO_DOW_MSC,O_DOW_DATAR,O_DOW_DATAM,O_DOW_DATAD, O_DOW_KRAJ, PLEC, WA_DATAR,WA_DATAM, WA_DATAD, ODP_KTO, ODP_KIEDY, MEL_KTO, MEL_KIEDY, ZD_DATAR, ZD_DATAM, ZD_DATAD, ZD_UPR_DATAR,
ZD_UPR_DATAM, ZD_UPR_DATAD, ZD_N, ZD_KOD, ZD_DOK, ZD_ORG, ZD_ORG_OPIS, ZD_MSC, IDZD_MSC, AKT_KIEDY)
VALUES(ODPSKR.IDUSC,ODPSKR.RK,ODPSKR.DZ,ODPSKR.NR,ODPSKR.NRP,ODPSKR.DZPL,ODPSKR.NRO,ODPSKR.NAZWPL,ODPSKR.NAZW,ODPSKR.IMIE1PL,ODPSKR.IMIE1,ODPSKR.IMIER,ODPSKR.UR_DATAR,ODPSKR.UR_DATAM,
ODPSKR.UR_DATAD, ODPSKR.UR_MSC,ODPSKR.IDUR_MSC, USCADM.fnNrStatToTeryt(ODPSKR.IDUR_MSC), ODPSKR.UR_KRAJ, ODPSKR.OJ_NAZW,ODPSKR.OJ_NAZWR, ODPSKR.OJ_IMIE1, ODPSKR.OJ_IMIER,ODPSKR.MA_NAZW,
ODPSKR.MA_NAZWRPL,ODPSKR.MA_NAZWR,ODPSKR.MA_IMIE1,ODPSKR.MA_IMIER,MELD.PESEL,MELD.A_MSC,MELD.IDA_MSC, USCADM.fnNrStatToTeryt(MELD.IDA_MSC), MELD.A_MSC_KP, MELD.A_ULICA, MELD.A_DOM,
MELD.A_LOKAL, MELD.A_KRAJ,MELD.TYP_ADR,MELD.MPESEL,MELD.OPESEL,MELD.M_DOW_TYP,MELD.M_DOW_NR, MELD.M_DOW_WYD,MELD.M_DOW_MSC,MELD.IDM_DOW_MSC,MELD.M_DOW_DATAR,MELD.M_DOW_DATAM,
MELD.M_DOW_DATAD,MELD.M_DOW_KRAJ,MELD.O_DOW_TYP,MELD.O_DOW_NR,MELD.O_DOW_WYD, MELD.O_DOW_MSC,MELD.IDO_DOW_MSC,MELD.O_DOW_DATAR,MELD.O_DOW_DATAM,MELD.O_DOW_DATAD, MELD.O_DOW_KRAJ,
ODPSKR.PLEC,AKT.WA_DATAR,AKT.WA_DATAM,AKT.WA_DATAD,ODPSKR.IDMR_KTO, ODPSKR.IDMR_KIEDYS,MELD.IDMR_KTO,ODPSKR.IDMR_KIEDYS,ODPSKR.ZD_DATAR,ODPSKR.ZD_DATAM, ODPSKR.ZD_DATAD, ODPSKR.ZD_UPR_DATAR,
ODPSKR.ZD_UPR_DATAM,ODPSKR.ZD_UPR_DATAD,ODPSKR.ZD_N, ODPSKR.ZD_KOD,ODPSKR.ZD_DOK,ODPSKR.ZD_ORG,ODPSKR.ZD_ORG_OPIS,ODPSKR.ZD_MSC,ODPSKR.IDZD_MSC, AKT.IDMR_KIEDYS)
from USCADM.USC_UODPSKR as ODPSKR
join USCADM.USC_UMELD as MELD on ODPSKR.RK = MELD.RK AND ODPSKR.DZ = MELD.DZ AND ODPSKR.NR = MELD.NR AND ODPSKR.NRP = MELD.NRP AND ODPSKR.IDUSC = MELD.IDUSC
join USCADM.USC_UAKT as AKT on ODPSKR.RK = AKT.RK AND ODPSKR.DZ = AKT.DZ AND ODPSKR.NR = AKT.NR AND ODPSKR.NRP = AKT.NRP AND ODPSKR.IDUSC = AKT.IDUSC
WHERE ODPSKR.RK = :NEW.RK AND ODPSKR.DZ = :NEW.DZ AND ODPSKR.NR = :NEW.NR AND ODPSKR.NRP = :NEW.NRP AND ODPSKR.IDUSC = :NEW.IDUSC;
end if;
END UMELD_PWEL_TRIG;
I get following errors:
Error(7,5): PL/SQL: SQL Statement ignored
Error(23,5): PL/SQL: ORA-00933: polecenie SQL niepoprawnie zakończone (not finished correctly)
Error(29,5): PL/SQL: SQL Statement ignored
Error(41,5): PL/SQL: ORA-00933: polecenie SQL niepoprawnie zakończone (not finished correctly)
You have confused INSERT...VALUES and INSERT...SELECT syntax. Your INSERT should be:
insert into USCADM.USC_PESELU (IDUSC, RK, DZ, NR, NRP, DZPL, NRO, NAZWPL, NAZW, IMIE1PL, IMIE1, IMIER, UR_DATAR, UR_DATAM, UR_DATAD, UR_MSC, IDUR_MSC, KTUR_MSC,PESEL.UR_KRAJ,
OJ_NAZW, OJ_NAZWR, OJ_IMIE1, OJ_IMIER, MA_NAZW, MA_NAZWRPL, MA_NAZWR, MA_IMIE1, MA_IMIER, PESEL, A_MSC, IDA_MSC, KRA_MSC, A_MSC_KP, A_ULICA, A_DOM, A_LOKAL,
A_KRAJ, TYP_ADR,MPESEL,OPESEL,M_DOW_TYP,M_DOW_NR, M_DOW_WYD, M_DOW_MSC, IDM_DOW_MSC, M_DOW_DATAR,M_DOW_DATAM, M_DOW_DATAD, M_DOW_KRAJ, O_DOW_TYP, O_DOW_NR, O_DOW_WYD,O_DOW_MSC,
IDO_DOW_MSC,O_DOW_DATAR,O_DOW_DATAM,O_DOW_DATAD, O_DOW_KRAJ, PLEC, WA_DATAR,WA_DATAM, WA_DATAD, ODP_KTO, ODP_KIEDY, MEL_KTO, MEL_KIEDY, ZD_DATAR, ZD_DATAM, ZD_DATAD, ZD_UPR_DATAR,
ZD_UPR_DATAM, ZD_UPR_DATAD, ZD_N, ZD_KOD, ZD_DOK, ZD_ORG, ZD_ORG_OPIS, ZD_MSC, IDZD_MSC, AKT_KIEDY)
SELECT ODPSKR.IDUSC,ODPSKR.RK,ODPSKR.DZ,ODPSKR.NR,ODPSKR.NRP,ODPSKR.DZPL,ODPSKR.NRO,ODPSKR.NAZWPL,ODPSKR.NAZW,ODPSKR.IMIE1PL,ODPSKR.IMIE1,ODPSKR.IMIER,ODPSKR.UR_DATAR,ODPSKR.UR_DATAM,
ODPSKR.UR_DATAD, ODPSKR.UR_MSC,ODPSKR.IDUR_MSC, USCADM.fnNrStatToTeryt(ODPSKR.IDUR_MSC), ODPSKR.UR_KRAJ, ODPSKR.OJ_NAZW,ODPSKR.OJ_NAZWR, ODPSKR.OJ_IMIE1, ODPSKR.OJ_IMIER,ODPSKR.MA_NAZW,
ODPSKR.MA_NAZWRPL,ODPSKR.MA_NAZWR,ODPSKR.MA_IMIE1,ODPSKR.MA_IMIER,MELD.PESEL,MELD.A_MSC,MELD.IDA_MSC, USCADM.fnNrStatToTeryt(MELD.IDA_MSC), MELD.A_MSC_KP, MELD.A_ULICA, MELD.A_DOM,
MELD.A_LOKAL, MELD.A_KRAJ,MELD.TYP_ADR,MELD.MPESEL,MELD.OPESEL,MELD.M_DOW_TYP,MELD.M_DOW_NR, MELD.M_DOW_WYD,MELD.M_DOW_MSC,MELD.IDM_DOW_MSC,MELD.M_DOW_DATAR,MELD.M_DOW_DATAM,
MELD.M_DOW_DATAD,MELD.M_DOW_KRAJ,MELD.O_DOW_TYP,MELD.O_DOW_NR,MELD.O_DOW_WYD, MELD.O_DOW_MSC,MELD.IDO_DOW_MSC,MELD.O_DOW_DATAR,MELD.O_DOW_DATAM,MELD.O_DOW_DATAD, MELD.O_DOW_KRAJ,
ODPSKR.PLEC,AKT.WA_DATAR,AKT.WA_DATAM,AKT.WA_DATAD,ODPSKR.IDMR_KTO, ODPSKR.IDMR_KIEDYS,MELD.IDMR_KTO,ODPSKR.IDMR_KIEDYS,ODPSKR.ZD_DATAR,ODPSKR.ZD_DATAM, ODPSKR.ZD_DATAD, ODPSKR.ZD_UPR_DATAR,
ODPSKR.ZD_UPR_DATAM,ODPSKR.ZD_UPR_DATAD,ODPSKR.ZD_N, ODPSKR.ZD_KOD,ODPSKR.ZD_DOK,ODPSKR.ZD_ORG,ODPSKR.ZD_ORG_OPIS,ODPSKR.ZD_MSC,ODPSKR.IDZD_MSC, AKT.IDMR_KIEDYS
from USCADM.USC_UODPSKR as ODPSKR
join USCADM.USC_UMELD as MELD on ODPSKR.RK = MELD.RK AND ODPSKR.DZ = MELD.DZ AND ODPSKR.NR = MELD.NR AND ODPSKR.NRP = MELD.NRP AND ODPSKR.IDUSC = MELD.IDUSC
join USCADM.USC_UAKT as AKT on ODPSKR.RK = AKT.RK AND ODPSKR.DZ = AKT.DZ AND ODPSKR.NR = AKT.NR AND ODPSKR.NRP = AKT.NRP AND ODPSKR.IDUSC = AKT.IDUSC
WHERE ODPSKR.RK = :NEW.RK AND ODPSKR.DZ = :NEW.DZ AND ODPSKR.NR = :NEW.NR AND ODPSKR.NRP = :NEW.NRP AND ODPSKR.IDUSC = :NEW.IDUSC;
CREATE OR replace TRIGGER umeld_pwel_trig
BEFORE INSERT OR UPDATE ON uscadm.usc_umeld
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (NEW.pwel_stat = 1)
DECLARE
ilosc INT := 0;
BEGIN
SELECT Count(*)
INTO ilosc
FROM uscadm.usc_peselu
WHERE rk = :NEW.rk
AND dz = :NEW.dz
AND nr = :NEW.nr
AND nrp = :NEW.nrp
AND idusc = :NEW.idusc;
IF ilosc = 1 THEN
UPDATE uscadm.usc_peselu
SET ( idusc, rk, dz, nr,
nrp, dzpl, nro, nazwpl,
nazw, imie1pl, imie1, imier,
ur_datar, ur_datam, ur_datad, ur_msc,
idur_msc, ktur_msc, ur_kraj, oj_nazw,
oj_nazwr, oj_imie1, oj_imier, ma_nazw,
ma_nazwrpl, ma_nazwr, ma_imie1, ma_imier,
pesel, a_msc, ida_msc, kta_msc,
a_msc_kp, a_ulica, a_dom, a_lokal,
a_kraj, typ_adr, mpesel, opesel,
m_dow_typ, m_dow_nr, m_dow_wyd, m_dow_msc,
idm_dow_msc, m_dow_datar, m_dow_datam, m_dow_datad,
m_dow_kraj, o_dow_typ, o_dow_nr, o_dow_wyd,
o_dow_msc, ido_dow_msc, o_dow_datar, o_dow_datam,
o_dow_datad, o_dow_kraj, plec, wa_datar,
wa_datam, wa_datad, odp_kto, odp_kiedy,
mel_kto, mel_kiedy, zd_datar, zd_datam,
zd_datad, zd_upr_datar, zd_upr_datam, zd_upr_datad,
zd_n, zd_kod, zd_dok, zd_org,
zd_org_opis, zd_msc, idzd_msc ) = (SELECT ODPSKR.idusc,
ODPSKR.rk,
ODPSKR.dz,
ODPSKR.nr,
ODPSKR.nrp,
ODPSKR.dzpl,
ODPSKR.nro,
ODPSKR.nazwpl,
ODPSKR.nazw,
ODPSKR.imie1pl,
ODPSKR.imie1,
ODPSKR.imier,
ODPSKR.ur_datar,
ODPSKR.ur_datam,
ODPSKR.ur_datad,
ODPSKR.ur_msc,
ODPSKR.idur_msc,
uscadm.Fnnrstattoteryt(ODPSKR.idur_msc),
ODPSKR.ur_kraj,
ODPSKR.oj_nazw,
ODPSKR.oj_nazwr,
ODPSKR.oj_imie1,
ODPSKR.oj_imier,
ODPSKR.ma_nazw,
ODPSKR.ma_nazwrpl,
ODPSKR.ma_nazwr,
ODPSKR.ma_imie1,
ODPSKR.ma_imier,
:NEW.pesel,
:NEW.a_msc,
:NEW.ida_msc,
uscadm.Fnnrstattoteryt(:NEW.ida_msc),
:NEW.a_msc_kp,
:NEW.a_ulica,
:NEW.a_dom,
:NEW.a_lokal,
:NEW.a_kraj,
:NEW.typ_adr,
:NEW.mpesel,
:NEW.opesel,
:NEW.m_dow_typ,
:NEW.m_dow_nr,
:NEW.m_dow_wyd,
:NEW.m_dow_msc,
:NEW.idm_dow_msc,
:NEW.m_dow_datar,
:NEW.m_dow_datam,
:NEW.m_dow_datad,
:NEW.m_dow_kraj,
:NEW.o_dow_typ,
:NEW.o_dow_nr,
:NEW.o_dow_wyd,
:NEW.o_dow_msc,
:NEW.ido_dow_msc,
:NEW.o_dow_datar,
:NEW.o_dow_datam,
:NEW.o_dow_datad,
:NEW.o_dow_kraj,
ODPSKR.plec,
AKT.wa_datar,
AKT.wa_datam,
AKT.wa_datad,
ODPSKR.idmr_kto,
ODPSKR.idmr_kiedys,
:NEW.idmr_kto,
:NEW.idmr_kiedys,
ODPSKR.zd_datar,
ODPSKR.zd_datam,
ODPSKR.zd_datad,
ODPSKR.zd_upr_datar,
ODPSKR.zd_upr_datam,
ODPSKR.zd_upr_datad,
ODPSKR.zd_n,
ODPSKR.zd_kod,
ODPSKR.zd_dok,
ODPSKR.zd_org,
ODPSKR.zd_org_opis,
ODPSKR.zd_msc,
ODPSKR.idzd_msc
FROM uscadm.usc_uodpskr ODPSKR
join uscadm.usc_uakt AKT
ON ODPSKR.rk = AKT.rk
AND ODPSKR.dz = AKT.dz
AND ODPSKR.nr = AKT.nr
AND ODPSKR.nrp = AKT.nrp
AND ODPSKR.idusc = AKT.idusc
WHERE ODPSKR.rk = :NEW.rk
AND ODPSKR.dz = :NEW.dz
AND ODPSKR.nr = :NEW.nr
AND ODPSKR.nrp = :NEW.nrp
AND ODPSKR.idusc = :NEW.idusc);
:NEW.pwel_stat := 2;
ELSIF ilosc = 0 THEN
INSERT INTO uscadm.usc_peselu
(idusc,
rk,
dz,
nr,
nrp,
dzpl,
nro,
nazwpl,
nazw,
imie1pl,
imie1,
imier,
ur_datar,
ur_datam,
ur_datad,
ur_msc,
idur_msc,
ktur_msc,
ur_kraj,
oj_nazw,
oj_nazwr,
oj_imie1,
oj_imier,
ma_nazw,
ma_nazwrpl,
ma_nazwr,
ma_imie1,
ma_imier,
pesel,
a_msc,
ida_msc,
kta_msc,
a_msc_kp,
a_ulica,
a_dom,
a_lokal,
a_kraj,
typ_adr,
mpesel,
opesel,
m_dow_typ,
m_dow_nr,
m_dow_wyd,
m_dow_msc,
idm_dow_msc,
m_dow_datar,
m_dow_datam,
m_dow_datad,
m_dow_kraj,
o_dow_typ,
o_dow_nr,
o_dow_wyd,
o_dow_msc,
ido_dow_msc,
o_dow_datar,
o_dow_datam,
o_dow_datad,
o_dow_kraj,
plec,
wa_datar,
wa_datam,
wa_datad,
odp_kto,
odp_kiedy,
mel_kto,
mel_kiedy,
zd_datar,
zd_datam,
zd_datad,
zd_upr_datar,
zd_upr_datam,
zd_upr_datad,
zd_n,
zd_kod,
zd_dok,
zd_org,
zd_org_opis,
zd_msc,
idzd_msc)
SELECT ODPSKR.idusc,
ODPSKR.rk,
ODPSKR.dz,
ODPSKR.nr,
ODPSKR.nrp,
ODPSKR.dzpl,
ODPSKR.nro,
ODPSKR.nazwpl,
ODPSKR.nazw,
ODPSKR.imie1pl,
ODPSKR.imie1,
ODPSKR.imier,
ODPSKR.ur_datar,
ODPSKR.ur_datam,
ODPSKR.ur_datad,
ODPSKR.ur_msc,
ODPSKR.idur_msc,
uscadm.Fnnrstattoteryt(ODPSKR.idur_msc),
ODPSKR.ur_kraj,
ODPSKR.oj_nazw,
ODPSKR.oj_nazwr,
ODPSKR.oj_imie1,
ODPSKR.oj_imier,
ODPSKR.ma_nazw,
ODPSKR.ma_nazwrpl,
ODPSKR.ma_nazwr,
ODPSKR.ma_imie1,
ODPSKR.ma_imier,
:NEW.pesel,
:NEW.a_msc,
:NEW.ida_msc,
uscadm.Fnnrstattoteryt(:NEW.ida_msc),
:NEW.a_msc_kp,
:NEW.a_ulica,
:NEW.a_dom,
:NEW.a_lokal,
:NEW.a_kraj,
:NEW.typ_adr,
:NEW.mpesel,
:NEW.opesel,
:NEW.m_dow_typ,
:NEW.m_dow_nr,
:NEW.m_dow_wyd,
:NEW.m_dow_msc,
:NEW.idm_dow_msc,
:NEW.m_dow_datar,
:NEW.m_dow_datam,
:NEW.m_dow_datad,
:NEW.m_dow_kraj,
:NEW.o_dow_typ,
:NEW.o_dow_nr,
:NEW.o_dow_wyd,
:NEW.o_dow_msc,
:NEW.ido_dow_msc,
:NEW.o_dow_datar,
:NEW.o_dow_datam,
:NEW.o_dow_datad,
:NEW.o_dow_kraj,
ODPSKR.plec,
AKT.wa_datar,
AKT.wa_datam,
AKT.wa_datad,
ODPSKR.idmr_kto,
ODPSKR.idmr_kiedys,
:NEW.idmr_kto,
ODPSKR.idmr_kiedys,
ODPSKR.zd_datar,
ODPSKR.zd_datam,
ODPSKR.zd_datad,
ODPSKR.zd_upr_datar,
ODPSKR.zd_upr_datam,
ODPSKR.zd_upr_datad,
ODPSKR.zd_n,
ODPSKR.zd_kod,
ODPSKR.zd_dok,
ODPSKR.zd_org,
ODPSKR.zd_org_opis,
ODPSKR.zd_msc,
ODPSKR.idzd_msc
FROM uscadm.usc_uodpskr ODPSKR
join uscadm.usc_uakt AKT
ON ODPSKR.rk = AKT.rk
AND ODPSKR.dz = AKT.dz
AND ODPSKR.nr = AKT.nr
AND ODPSKR.nrp = AKT.nrp
AND ODPSKR.idusc = AKT.idusc
WHERE ODPSKR.rk = :NEW.rk
AND ODPSKR.dz = :NEW.dz
AND ODPSKR.nr = :NEW.nr
AND ODPSKR.nrp = :NEW.nrp
AND ODPSKR.idusc = :NEW.idusc;
:NEW.pwel_stat := 2;
END IF;
END umeld_pwel_trig;
Seems like i messed up the syntax real bad. this works.
Edit:
Had some problems with mutable error in trigger fixed it with the updated script above.
Related
Does Field order matter in an inner join for access SQL?
I have a query that requires ONE HUNDRED fields to be joined from one table to another. instead of manually going through the query designer, i decided to build the join using excel. When i put the code in to the SQL side of the query, then clicked designer, it choked on all 100 field comparisons and removed them. i proceeded to manually click drag the entire set of 100 field to join them all. somehow it worked. now when i look at the sql code for how access did it, it looks almost identical to my code. the only difference that i can identify is that instead of it going from A-Z, it goes Z-A. Original Query PARAMETERS pn TEXT (255) ,tt TEXT (255) ,sns Long ,sne Long ,ds DATETIME ,de DATETIME; SELECT y.Short_Description1 ,y.Data1 ,y.Short_Description2 ,y.Data2 ,y.Short_Description3 ,y.Data3 ,y.Short_Description4 ,y.Data4 ,y.Short_Description5 ,y.Data5 ,y.Short_Description6 ,y.Data6 ,y.Short_Description7 ,y.Data7 ,y.Short_Description8 ,y.Data8 ,y.Short_Description9 ,y.Data9 ,y.Short_Description10 ,y.Data10 ,y.Short_Description11 ,y.Data11 ,y.Short_Description12 ,y.Data12 ,y.Short_Description13 ,y.Data13 ,y.Short_Description14 ,y.Data14 ,y.Short_Description15 ,y.Data15 ,y.Short_Description16 ,y.Data16 ,y.Short_Description17 ,y.Data17 ,y.Short_Description18 ,y.Data18 ,y.Short_Description19 ,y.Data19 ,y.Short_Description20 ,y.Data20 ,y.Short_Description21 ,y.Data21 ,y.Short_Description22 ,y.Data22 ,y.Short_Description23 ,y.Data23 ,y.Short_Description24 ,y.Data24 ,y.Short_Description25 ,y.Data25 ,y.Short_Description26 ,y.Data26 ,y.Short_Description27 ,y.Data27 ,y.Short_Description28 ,y.Data28 ,y.Short_Description29 ,y.Data29 ,y.Short_Description30 ,y.Data30 ,y.Short_Description31 ,y.Data31 ,y.Short_Description32 ,y.Data32 ,y.Short_Description33 ,y.Data33 ,y.Short_Description34 ,y.Data34 ,y.Short_Description35 ,y.Data35 ,y.Short_Description36 ,y.Data36 ,y.Short_Description37 ,y.Data37 ,y.Short_Description38 ,y.Data38 ,y.Short_Description39 ,y.Data39 ,y.Short_Description40 ,y.Data40 ,y.Short_Description41 ,y.Data41 ,y.Short_Description42 ,y.Data42 ,y.Short_Description43 ,y.Data43 ,y.Short_Description44 ,y.Data44 ,y.Short_Description45 ,y.Data45 ,y.Short_Description46 ,y.Data46 ,y.Short_Description47 ,y.Data47 ,y.Short_Description48 ,y.Data48 ,y.Short_Description49 ,y.Data49 ,y.Short_Description50 ,y.Data50 ,y.Short_Description51 ,y.Data51 ,y.Short_Description52 ,y.Data52 ,y.Short_Description53 ,y.Data53 ,y.Short_Description54 ,y.Data54 ,y.Short_Description55 ,y.Data55 ,y.Short_Description56 ,y.Data56 ,y.Short_Description57 ,y.Data57 ,y.Short_Description58 ,y.Data58 ,y.Short_Description59 ,y.Data59 ,y.Short_Description60 ,y.Data60 ,y.Short_Description61 ,y.Data61 ,y.Short_Description62 ,y.Data62 ,y.Short_Description63 ,y.Data63 ,y.Short_Description64 ,y.Data64 ,y.Short_Description65 ,y.Data65 ,y.Short_Description66 ,y.Data66 ,y.Short_Description67 ,y.Data67 ,y.Short_Description68 ,y.Data68 ,y.Short_Description69 ,y.Data69 ,y.Short_Description70 ,y.Data70 ,y.Short_Description71 ,y.Data71 ,y.Short_Description72 ,y.Data72 ,y.Short_Description73 ,y.Data73 ,y.Short_Description74 ,y.Data74 ,y.Short_Description75 ,y.Data75 ,y.Short_Description76 ,y.Data76 ,y.Short_Description77 ,y.Data77 ,y.Short_Description78 ,y.Data78 ,y.Short_Description79 ,y.Data79 ,y.Short_Description80 ,y.Data80 ,y.Short_Description81 ,y.Data81 ,y.Short_Description82 ,y.Data82 ,y.Short_Description83 ,y.Data83 ,y.Short_Description84 ,y.Data84 ,y.Short_Description85 ,y.Data85 ,y.Short_Description86 ,y.Data86 ,y.Short_Description87 ,y.Data87 ,y.Short_Description88 ,y.Data88 ,y.Short_Description89 ,y.Data89 ,y.Short_Description90 ,y.Data90 ,y.Short_Description91 ,y.Data91 ,y.Short_Description92 ,y.Data92 ,y.Short_Description93 ,y.Data93 ,y.Short_Description94 ,y.Data94 ,y.Short_Description95 ,y.Data95 ,y.Short_Description96 ,y.Data96 ,y.Short_Description97 ,y.Data97 ,y.Short_Description98 ,y.Data98 ,y.Short_Description99 ,y.Data99 ,y.Short_Description100 ,y.Data100 ,x.rownum FROM qryIndividualTestData100Descriptions AS x INNER JOIN IndividualTestData100 AS y ON (x.Short_Description1 = y.Short_Description1) AND (x.Short_Description2 = y.Short_Description2) AND (x.Short_Description3 = y.Short_Description3) AND (x.Short_Description4 = y.Short_Description4) AND (x.Short_Description5 = y.Short_Description5) AND (x.Short_Description6 = y.Short_Description6) AND (x.Short_Description7 = y.Short_Description7) AND (x.Short_Description8 = y.Short_Description8) AND (x.Short_Description9 = y.Short_Description9) AND (x.Short_Description10 = y.Short_Description10) AND (x.Short_Description11 = y.Short_Description11) AND (x.Short_Description12 = y.Short_Description12) AND (x.Short_Description13 = y.Short_Description13) AND (x.Short_Description14 = y.Short_Description14) AND (x.Short_Description15 = y.Short_Description15) AND (x.Short_Description16 = y.Short_Description16) AND (x.Short_Description17 = y.Short_Description17) AND (x.Short_Description18 = y.Short_Description18) AND (x.Short_Description19 = y.Short_Description19) AND (x.Short_Description20 = y.Short_Description20) AND (x.Short_Description21 = y.Short_Description21) AND (x.Short_Description22 = y.Short_Description22) AND (x.Short_Description23 = y.Short_Description23) AND (x.Short_Description24 = y.Short_Description24) AND (x.Short_Description25 = y.Short_Description25) AND (x.Short_Description26 = y.Short_Description26) AND (x.Short_Description27 = y.Short_Description27) AND (x.Short_Description28 = y.Short_Description28) AND (x.Short_Description29 = y.Short_Description29) AND (x.Short_Description30 = y.Short_Description30) AND (x.Short_Description31 = y.Short_Description31) AND (x.Short_Description32 = y.Short_Description32) AND (x.Short_Description33 = y.Short_Description33) AND (x.Short_Description34 = y.Short_Description34) AND (x.Short_Description35 = y.Short_Description35) AND (x.Short_Description36 = y.Short_Description36) AND (x.Short_Description37 = y.Short_Description37) AND (x.Short_Description38 = y.Short_Description38) AND (x.Short_Description39 = y.Short_Description39) AND (x.Short_Description40 = y.Short_Description40) AND (x.Short_Description41 = y.Short_Description41) AND (x.Short_Description42 = y.Short_Description42) AND (x.Short_Description43 = y.Short_Description43) AND (x.Short_Description44 = y.Short_Description44) AND (x.Short_Description45 = y.Short_Description45) AND (x.Short_Description46 = y.Short_Description46) AND (x.Short_Description47 = y.Short_Description47) AND (x.Short_Description48 = y.Short_Description48) AND (x.Short_Description49 = y.Short_Description49) AND (x.Short_Description50 = y.Short_Description50) AND (x.Short_Description51 = y.Short_Description51) AND (x.Short_Description52 = y.Short_Description52) AND (x.Short_Description53 = y.Short_Description53) AND (x.Short_Description54 = y.Short_Description54) AND (x.Short_Description55 = y.Short_Description55) AND (x.Short_Description56 = y.Short_Description56) AND (x.Short_Description57 = y.Short_Description57) AND (x.Short_Description58 = y.Short_Description58) AND (x.Short_Description59 = y.Short_Description59) AND (x.Short_Description60 = y.Short_Description60) AND (x.Short_Description61 = y.Short_Description61) AND (x.Short_Description62 = y.Short_Description62) AND (x.Short_Description63 = y.Short_Description63) AND (x.Short_Description64 = y.Short_Description64) AND (x.Short_Description65 = y.Short_Description65) AND (x.Short_Description66 = y.Short_Description66) AND (x.Short_Description67 = y.Short_Description67) AND (x.Short_Description68 = y.Short_Description68) AND (x.Short_Description69 = y.Short_Description69) AND (x.Short_Description70 = y.Short_Description70) AND (x.Short_Description71 = y.Short_Description71) AND (x.Short_Description72 = y.Short_Description72) AND (x.Short_Description73 = y.Short_Description73) AND (x.Short_Description74 = y.Short_Description74) AND (x.Short_Description75 = y.Short_Description75) AND (x.Short_Description76 = y.Short_Description76) AND (x.Short_Description77 = y.Short_Description77) AND (x.Short_Description78 = y.Short_Description78) AND (x.Short_Description79 = y.Short_Description79) AND (x.Short_Description80 = y.Short_Description80) AND (x.Short_Description81 = y.Short_Description81) AND (x.Short_Description82 = y.Short_Description82) AND (x.Short_Description83 = y.Short_Description83) AND (x.Short_Description84 = y.Short_Description84) AND (x.Short_Description85 = y.Short_Description85) AND (x.Short_Description86 = y.Short_Description86) AND (x.Short_Description87 = y.Short_Description87) AND (x.Short_Description88 = y.Short_Description88) AND (x.Short_Description89 = y.Short_Description89) AND (x.Short_Description90 = y.Short_Description90) AND (x.Short_Description91 = y.Short_Description91) AND (x.Short_Description92 = y.Short_Description92) AND (x.Short_Description93 = y.Short_Description93) AND (x.Short_Description94 = y.Short_Description94) AND (x.Short_Description95 = y.Short_Description95) AND (x.Short_Description96 = y.Short_Description96) AND (x.Short_Description97 = y.Short_Description97) AND (x.Short_Description98 = y.Short_Description98) AND (x.Short_Description99 = y.Short_Description99) AND (x.Short_Description100 = y.Short_Description100) WHERE ( ((y.[Part_Number]) LIKE [pn] & "*" & [tt]) AND ( (y.[Serial_Number]) >= [sns] AND (y.[Serial_Number]) <= [sne] ) AND ( (y.[Test_Date]) >= [ds] AND (y.[Test_Date]) <= [de] ) ); Access Generated version PARAMETERS pn TEXT (255) ,tt TEXT (255) ,sns Long ,sne Long ,ds DATETIME ,de DATETIME; SELECT y.Short_Description1 ,y.Data1 ,y.Short_Description2 ,y.Data2 ,y.Short_Description3 ,y.Data3 ,y.Short_Description4 ,y.Data4 ,y.Short_Description5 ,y.Data5 ,y.Short_Description6 ,y.Data6 ,y.Short_Description7 ,y.Data7 ,y.Short_Description8 ,y.Data8 ,y.Short_Description9 ,y.Data9 ,y.Short_Description10 ,y.Data10 ,y.Short_Description11 ,y.Data11 ,y.Short_Description12 ,y.Data12 ,y.Short_Description13 ,y.Data13 ,y.Short_Description14 ,y.Data14 ,y.Short_Description15 ,y.Data15 ,y.Short_Description16 ,y.Data16 ,y.Short_Description17 ,y.Data17 ,y.Short_Description18 ,y.Data18 ,y.Short_Description19 ,y.Data19 ,y.Short_Description20 ,y.Data20 ,y.Short_Description21 ,y.Data21 ,y.Short_Description22 ,y.Data22 ,y.Short_Description23 ,y.Data23 ,y.Short_Description24 ,y.Data24 ,y.Short_Description25 ,y.Data25 ,y.Short_Description26 ,y.Data26 ,y.Short_Description27 ,y.Data27 ,y.Short_Description28 ,y.Data28 ,y.Short_Description29 ,y.Data29 ,y.Short_Description30 ,y.Data30 ,y.Short_Description31 ,y.Data31 ,y.Short_Description32 ,y.Data32 ,y.Short_Description33 ,y.Data33 ,y.Short_Description34 ,y.Data34 ,y.Short_Description35 ,y.Data35 ,y.Short_Description36 ,y.Data36 ,y.Short_Description37 ,y.Data37 ,y.Short_Description38 ,y.Data38 ,y.Short_Description39 ,y.Data39 ,y.Short_Description40 ,y.Data40 ,y.Short_Description41 ,y.Data41 ,y.Short_Description42 ,y.Data42 ,y.Short_Description43 ,y.Data43 ,y.Short_Description44 ,y.Data44 ,y.Short_Description45 ,y.Data45 ,y.Short_Description46 ,y.Data46 ,y.Short_Description47 ,y.Data47 ,y.Short_Description48 ,y.Data48 ,y.Short_Description49 ,y.Data49 ,y.Short_Description50 ,y.Data50 ,y.Short_Description51 ,y.Data51 ,y.Short_Description52 ,y.Data52 ,y.Short_Description53 ,y.Data53 ,y.Short_Description54 ,y.Data54 ,y.Short_Description55 ,y.Data55 ,y.Short_Description56 ,y.Data56 ,y.Short_Description57 ,y.Data57 ,y.Short_Description58 ,y.Data58 ,y.Short_Description59 ,y.Data59 ,y.Short_Description60 ,y.Data60 ,y.Short_Description61 ,y.Data61 ,y.Short_Description62 ,y.Data62 ,y.Short_Description63 ,y.Data63 ,y.Short_Description64 ,y.Data64 ,y.Short_Description65 ,y.Data65 ,y.Short_Description66 ,y.Data66 ,y.Short_Description67 ,y.Data67 ,y.Short_Description68 ,y.Data68 ,y.Short_Description69 ,y.Data69 ,y.Short_Description70 ,y.Data70 ,y.Short_Description71 ,y.Data71 ,y.Short_Description72 ,y.Data72 ,y.Short_Description73 ,y.Data73 ,y.Short_Description74 ,y.Data74 ,y.Short_Description75 ,y.Data75 ,y.Short_Description76 ,y.Data76 ,y.Short_Description77 ,y.Data77 ,y.Short_Description78 ,y.Data78 ,y.Short_Description79 ,y.Data79 ,y.Short_Description80 ,y.Data80 ,y.Short_Description81 ,y.Data81 ,y.Short_Description82 ,y.Data82 ,y.Short_Description83 ,y.Data83 ,y.Short_Description84 ,y.Data84 ,y.Short_Description85 ,y.Data85 ,y.Short_Description86 ,y.Data86 ,y.Short_Description87 ,y.Data87 ,y.Short_Description88 ,y.Data88 ,y.Short_Description89 ,y.Data89 ,y.Short_Description90 ,y.Data90 ,y.Short_Description91 ,y.Data91 ,y.Short_Description92 ,y.Data92 ,y.Short_Description93 ,y.Data93 ,y.Short_Description94 ,y.Data94 ,y.Short_Description95 ,y.Data95 ,y.Short_Description96 ,y.Data96 ,y.Short_Description97 ,y.Data97 ,y.Short_Description98 ,y.Data98 ,y.Short_Description99 ,y.Data99 ,y.Short_Description100 ,y.Data100 ,x.rownum FROM qryIndividualTestData100Descriptions AS x INNER JOIN individualtestdata100 AS y ON (x.Short_Description100 = y.Short_Description100) AND (x.Short_Description99 = y.Short_Description99) AND (x.Short_Description98 = y.Short_Description98) AND (x.Short_Description97 = y.Short_Description97) AND (x.Short_Description96 = y.Short_Description96) AND (x.Short_Description95 = y.Short_Description95) AND (x.Short_Description94 = y.Short_Description94) AND (x.Short_Description93 = y.Short_Description93) AND (x.Short_Description92 = y.Short_Description92) AND (x.Short_Description91 = y.Short_Description91) AND (x.Short_Description90 = y.Short_Description90) AND (x.Short_Description89 = y.Short_Description89) AND (x.Short_Description88 = y.Short_Description88) AND (x.Short_Description87 = y.Short_Description87) AND (x.Short_Description86 = y.Short_Description86) AND (x.Short_Description85 = y.Short_Description85) AND (x.Short_Description84 = y.Short_Description84) AND (x.Short_Description83 = y.Short_Description83) AND (x.Short_Description82 = y.Short_Description82) AND (x.Short_Description81 = y.Short_Description81) AND (x.Short_Description80 = y.Short_Description80) AND (x.Short_Description79 = y.Short_Description79) AND (x.Short_Description78 = y.Short_Description78) AND (x.Short_Description77 = y.Short_Description77) AND (x.Short_Description76 = y.Short_Description76) AND (x.Short_Description75 = y.Short_Description75) AND (x.Short_Description74 = y.Short_Description74) AND (x.Short_Description73 = y.Short_Description73) AND (x.Short_Description72 = y.Short_Description72) AND (x.Short_Description71 = y.Short_Description71) AND (x.Short_Description70 = y.Short_Description70) AND (x.Short_Description69 = y.Short_Description69) AND (x.Short_Description68 = y.Short_Description68) AND (x.Short_Description67 = y.Short_Description67) AND (x.Short_Description66 = y.Short_Description66) AND (x.Short_Description65 = y.Short_Description65) AND (x.Short_Description64 = y.Short_Description64) AND (x.Short_Description63 = y.Short_Description63) AND (x.Short_Description62 = y.Short_Description62) AND (x.Short_Description61 = y.Short_Description61) AND (x.Short_Description60 = y.Short_Description60) AND (x.Short_Description59 = y.Short_Description59) AND (x.Short_Description58 = y.Short_Description58) AND (x.Short_Description57 = y.Short_Description57) AND (x.Short_Description56 = y.Short_Description56) AND (x.Short_Description55 = y.Short_Description55) AND (x.Short_Description54 = y.Short_Description54) AND (x.Short_Description53 = y.Short_Description53) AND (x.Short_Description52 = y.Short_Description52) AND (x.Short_Description51 = y.Short_Description51) AND (x.Short_Description50 = y.Short_Description50) AND (x.Short_Description49 = y.Short_Description49) AND (x.Short_Description48 = y.Short_Description48) AND (x.Short_Description47 = y.Short_Description47) AND (x.Short_Description46 = y.Short_Description46) AND (x.Short_Description45 = y.Short_Description45) AND (x.Short_Description44 = y.Short_Description44) AND (x.Short_Description43 = y.Short_Description43) AND (x.Short_Description42 = y.Short_Description42) AND (x.Short_Description41 = y.Short_Description41) AND (x.Short_Description40 = y.Short_Description40) AND (x.Short_Description39 = y.Short_Description39) AND (x.Short_Description38 = y.Short_Description38) AND (x.Short_Description37 = y.Short_Description37) AND (x.Short_Description36 = y.Short_Description36) AND (x.Short_Description35 = y.Short_Description35) AND (x.Short_Description34 = y.Short_Description34) AND (x.Short_Description33 = y.Short_Description33) AND (x.Short_Description32 = y.Short_Description32) AND (x.Short_Description31 = y.Short_Description31) AND (x.Short_Description30 = y.Short_Description30) AND (x.Short_Description29 = y.Short_Description29) AND (x.Short_Description28 = y.Short_Description28) AND (x.Short_Description27 = y.Short_Description27) AND (x.Short_Description26 = y.Short_Description26) AND (x.Short_Description25 = y.Short_Description25) AND (x.Short_Description24 = y.Short_Description24) AND (x.Short_Description23 = y.Short_Description23) AND (x.Short_Description22 = y.Short_Description22) AND (x.Short_Description21 = y.Short_Description21) AND (x.Short_Description20 = y.Short_Description20) AND (x.Short_Description19 = y.Short_Description19) AND (x.Short_Description18 = y.Short_Description18) AND (x.Short_Description17 = y.Short_Description17) AND (x.Short_Description16 = y.Short_Description16) AND (x.Short_Description15 = y.Short_Description15) AND (x.Short_Description14 = y.Short_Description14) AND (x.Short_Description13 = y.Short_Description13) AND (x.Short_Description12 = y.Short_Description12) AND (x.Short_Description11 = y.Short_Description11) AND (x.Short_Description10 = y.Short_Description10) AND (x.Short_Description9 = y.Short_Description9) AND (x.Short_Description8 = y.Short_Description8) AND (x.Short_Description7 = y.Short_Description7) AND (x.Short_Description6 = y.Short_Description6) AND (x.Short_Description5 = y.Short_Description5) AND (x.Short_Description4 = y.Short_Description4) AND (x.Short_Description3 = y.Short_Description3) AND (x.Short_Description2 = y.Short_Description2) AND (x.Short_Description1 = y.Short_Description1) WHERE ( ((y.Part_Number) LIKE [pn] & "*" & [tt]) AND ( (y.Serial_Number) >= [sns] AND (y.Serial_Number) <= [sne] ) AND ( (y.Test_Date) >= [ds] AND (y.Test_Date) <= [de] ) ); Why does access choke on the query?
[__NSDictionaryI objectAtIndex:]: unrecognized selector sent to instance
I am getting this error [__NSDictionaryI objectAtIndex:]: unrecognized selector sent to instance how to read one by one each row data.this is my NSMutableArray. I need to read single code line datad from this array. NSMutableArray *result = [obj objectForKey:#"quotes"]; NSLog(#"%#",result); //dataCenter.currency_array=result; for (int i=0; i<[result count]; i++) { NSLog(#"%#",[result objectAtIndex:i]); NSDictionary* obj = [result objectAtIndex:i]; //[datasource addObject:obj]; NSLog(#"%#",obj); } { USDAED = "3.672304"; USDAFN = "67.503991"; USDALL = "123.503989"; USDAMD = "484.179993"; USDANG = "1.790403"; USDAOA = "165.087006"; USDARS = "15.374041"; USDAUD = "1.333604"; USDAWG = "1.79"; USDAZN = "1.702041"; USDBAM = "1.797804"; USDBBD = 2; USDBDT = "82.089996"; USDBGN = "1.789404"; USDBHD = "0.376204"; USDBIF = "1700.75"; USDBMD = 1; USDBND = "1.396804"; USDBOB = "6.890399"; USDBRL = "3.171604"; USDBSD = 1; USDBTC = "0.000757"; USDBTN = "64.125041"; USDBWP = "10.422504"; USDBYN = "1.870398"; USDBYR = 20020; USDBZD = "1.997804"; USDCAD = "1.365204"; USDCDF = "1398.949951"; USDCHF = "0.993604"; USDCLF = "0.02487"; USDCLP = "666.429993"; USDCNY = "6.889904"; USDCOP = "2937.300049"; USDCRC = "551.080017"; USDCUC = 1; USDCUP = "1.00036"; USDCVE = "101.209999"; USDCZK = "24.615999"; USDDJF = "178.000359"; USDDKK = "6.81567"; USDDOP = "47.029999"; USDDZD = "109.047997"; USDEEK = "14.04404"; USDEGP = "18.049999"; USDERN = "15.290392"; USDETB = "22.809999"; USDEUR = "0.917704"; USDFJD = "2.097504"; USDFKP = "0.771604"; USDGBP = "0.77219"; USDGEL = "2.465104"; USDGGP = "0.772237"; USDGHS = "4.173304"; USDGIP = "0.771904"; USDGMD = "44.000355"; USDGNF = "9200.000355"; USDGTQ = "7.33804"; USDGYD = "204.460007"; USDHKD = "7.776604"; USDHNL = "23.350388"; USDHRK = "6.804904"; USDHTG = "67.709999"; USDHUF = "286.959991"; USDIDR = 13327; USDILS = "3.61904"; USDIMP = "0.772237"; USDINR = "64.269997"; USDIQD = 1181; USDIRR = "32439.000352"; USDISK = "106.199997"; USDJEP = "0.772237"; USDJMD = "128.130005"; USDJOD = "0.708804"; USDJPY = "111.495003"; USDKES = "102.949997"; USDKGS = "67.474998"; USDKHR = "3984.00035"; USDKMF = "461.790009"; USDKPW = "900.00035"; USDKRW = "1136.369995"; USDKWD = "0.303904"; USDKYD = "0.820383"; USDKZT = "314.51001"; USDLAK = "8194.799805000001"; USDLBP = "1506.699951"; USDLKR = "152.050003"; USDLRD = "91.000348"; USDLSL = "13.371039"; USDLTL = "3.048704"; USDLVL = "0.62055"; USDLYD = "1.407804"; USDMAD = "9.913038999999999"; USDMDL = "19.065001"; USDMGA = "3150.000347"; USDMKD = "56.189999"; USDMMK = "1358.000346"; USDMNT = "2409.000346"; USDMOP = "8.009904000000001"; USDMRO = "357.000346"; USDMUR = "34.669998"; USDMVR = "15.440378"; USDMWK = "717.969971"; USDMXN = "18.809039"; USDMYR = "4.339039"; USDMZN = "70.44000200000001"; USDNAD = "13.335039"; USDNGN = "314.503725"; USDNIO = "29.403722"; USDNOK = "8.583204"; USDNPR = "102.099998"; USDNZD = "1.455704"; USDOMR = "0.384504"; USDPAB = 1; USDPEN = "3.243104"; USDPGK = "3.283039"; USDPHP = "50.209999"; USDPKR = "104.599998"; USDPLN = "3.878038"; USDPYG = "5558.000341"; USDQAR = "3.640804"; USDRON = "4.156704"; USDRSD = "113.024902"; USDRUB = "56.917038"; USDRWF = "819.02002"; USDSAR = "3.749604"; USDSBD = "7.840604"; USDSCR = "13.334038"; USDSDG = "6.660372"; USDSEK = "8.857404000000001"; USDSGD = "1.396038"; USDSHP = "0.771904"; USDSLL = "7450.000338"; USDSOS = "549.0003380000001"; USDSRD = "7.48037"; USDSTD = "22487.400391"; USDSVC = "8.722038"; USDSYP = "514.97998"; USDSZL = "13.337404"; USDTHB = "34.570369"; USDTJS = "8.477104000000001"; USDTMT = "3.4"; USDTND = "2.414038"; USDTOP = "2.313904"; USDTRY = "3.550604"; USDTTD = "6.709504"; USDTWD = "30.155001"; USDTZS = "2228.000335"; USDUAH = "26.525038"; USDUGX = "3640.899902"; USDUSD = 1; USDUYU = "28.070367"; USDUZS = "3705.000334"; USDVEF = "9.974504"; USDVND = 22739; USDVUV = "109.550003"; USDWST = "2.593604"; USDXAF = "601.590027"; USDXAG = "0.058089"; USDXAU = "0.000789"; USDXCD = "2.703604"; USDXDR = "0.729382"; USDXOF = "603.659973"; USDXPF = "108.919998"; USDYER = "249.949997"; USDZAR = "13.361604"; USDZMK = "9.325037"; USDZMW = "9.280362999999999"; USDZWL = "322.355011"; } how i can read single record.
You have a NSDictionary not an NSArray. NSDictionary can't handle object at index. If you want to loop through a NSDictionary use this for (NSString* key in [result allkeys]) { float entry = [[result objectForKey:key] floatValue]; // do your stuff here for each entry } edit And you should change this line NSMutableArray *result = [obj objectForKey:#"quotes"]; To NSDictionary *result = [obj objectForKey:#"quotes"];
Apache ignite query not working well with index
I upload the data in ignite 3 cache and total data around 1 million in all 3 caches.while i run query on it i got result in 1s and its generate below query plan SELECT DISTINCT A3.VAL2 AS __C0 FROM DPHAF.DPHAF A1 /* DPHAF.DPHAF.__SCAN_ */ /* WHERE (A1.VAL0 = 'dg~') AND ((A1.PROP6 = '1oh~#has_single_bond') AND (A1.PROP0 = '4xm~#type')) */ INNER JOIN DS_AF.DS_AF S1 /* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A1.PROP6 AND ENTITY = A1.ENTRY */ ON 1=1 /* WHERE (A1.PROP6 = S1.PROP) AND (A1.ENTRY = S1.ENTITY) */ INNER JOIN DPHAF.DPHAF A2 /* DPHAF."entry_asc_idx": ENTRY = S1.ELEM */ ON 1=1 /* WHERE (S1.ELEM = A2.ENTRY) AND ((A2.PROP0 = '4xm~#type') AND ((A2.PROP6 = '1oh~#has_single_bond') AND (A2.VAL0 = '7a~'))) */ INNER JOIN DS_AF.DS_AF S2 /* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A2.PROP6 AND ENTITY = A2.ENTRY */ ON 1=1 /* WHERE (A2.PROP6 = S2.PROP) AND (A2.ENTRY = S2.ENTITY) */ INNER JOIN DPHAF.DPHAF A3 /* DPHAF."entry_asc_idx": ENTRY = S2.ELEM */ ON 1=1 WHERE (A3.PROP2 = '1oh~#is_atom_of') AND ((A3.VAL0 = '7a~') AND ((A3.PROP0 = '4xm~#type') AND ((S2.ELEM = A3.ENTRY) AND ((A2.PROP6 = S2.PROP) AND ((A2.PROP6 = '1oh~#has_single_bond') AND ((A2.ENTRY = S2.ENTITY) AND ((A2.VAL0 = '7a~') AND ((A2.PROP0 = '4xm~#type') AND ((S1.ELEM = A2.ENTRY) AND ((A1.PROP6 = S1.PROP) AND ((A1.PROP6 = '1oh~#has_single_bond') AND ((A1.ENTRY = S1.ENTITY) AND ((A1.PROP0 = '4xm~#type') AND (A1.VAL0 = 'dg~')))))))))))))) LIMIT 1000 SELECT DISTINCT __C0 AS VAL2 FROM PUBLIC.__T0 /* DPHAF."merge_scan" */ LIMIT 1000 as you notice there is full cache scan here /* DPHAF.DPHAF.__SCAN_ */ After that when we add index on DPHAF group index it will give us below plan SELECT A1.VAL2 AS __C0 FROM DPHAF.DPHAF A1 /* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '7a~' AND PROP0 = '4xm~#type' */ /* WHERE (A1.PROP0 = '4xm~#type') AND ((A1.PROP2 = '1oh~#is_atom_of') AND ((A1.VAL0 = '7a~') AND ((A1.VAL5 = '3') AND ((A1.PROP8 = '1oh~#has_double_bond') AND (A1.PROP6 = '1oh~#has_single_bond'))))) */ INNER JOIN DPHAF.DPHAF A3 /* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '7a~' AND PROP0 = '4xm~#type' */ ON 1=1 /* WHERE (A3.PROP0 = '4xm~#type') AND ((A3.VAL5 = '1') AND (A3.VAL0 = '7a~')) */ INNER JOIN DPHAF.DPHAF A4 /* DPHAF."prop0_asc_val0_asc_idx": VAL0 = '562~' AND PROP0 = '4xm~#type' */ ON 1=1 /* WHERE (A4.PROP0 = '4xm~#type') AND ((A4.VAL5 = '1') AND (A4.VAL0 = '562~')) */ INNER JOIN DS_AF.DS_AF S1 /* DS_AF."prop_asc_entity_asc_elem_asc_typ_asc_idx": PROP = A1.PROP6 AND ENTITY = A1.ENTRY */ ON 1=1 /* WHERE (A1.PROP6 = S1.PROP) AND (A1.ENTRY = S1.ENTITY) */ INNER JOIN DPHAF.DPHAF A2 /* DPHAF."entry_asc_idx": ENTRY = S1.ELEM */ ON 1=1 /* WHERE (S1.ELEM = A2.ENTRY) AND ((A2.VAL5 = '1') AND (A2.VAL0 = '562~')) */ INNER JOIN DS_AF.DS_AF S2 /* DS_AF."prop_asc_elem_asc_entity_asc_typ_asc_idx": ELEM = A3.ENTRY AND PROP = A1.PROP6 AND ENTITY = A1.ENTRY */ ON 1=1 /* WHERE (A1.ENTRY = S2.ENTITY) AND ((S2.ELEM = A3.ENTRY) AND (A1.PROP6 = S2.PROP)) */ INNER JOIN DS_AF.DS_AF D1 /* DS_AF."prop_asc_elem_asc_entity_asc_typ_asc_idx": ELEM = A4.ENTRY AND PROP = A1.PROP8 AND ENTITY = A1.ENTRY */ ON 1=1 WHERE (A4.VAL5 = '1') AND ((A4.VAL0 = '562~') AND ((A4.PROP0 = '4xm~#type') AND ((D1.ELEM = A4.ENTRY) AND ((A1.PROP8 = D1.PROP) AND ((A1.PROP8 = '1oh~#has_double_bond') AND ((A1.ENTRY = D1.ENTITY) AND ((A3.VAL5 = '1') AND ((A3.VAL0 = '7a~') AND ((A3.PROP0 = '4xm~#type') AND ((S2.ELEM = A3.ENTRY) AND ((A1.PROP6 = S2.PROP) AND ((A1.ENTRY = S2.ENTITY) AND ((A2.VAL5 = '1') AND ((A2.VAL0 = '562~') AND ((S1.ELEM = A2.ENTRY) AND ((A1.PROP6 = S1.PROP) AND ((A1.PROP6 = '1oh~#has_single_bond') AND ((A1.ENTRY = S1.ENTITY) AND ((A1.VAL5 = '3') AND ((A1.VAL0 = '7a~') AND ((A1.PROP2 = '1oh~#is_atom_of') AND (A1.PROP0 = '4xm~#type')))))))))))))))))))))) SELECT __C0 AS VAL2 FROM PUBLIC.__T0 /* DPHAF."merge_scan" */ Here you can see we dont have full scan of DPHAF but my query is running for soo long or infinite so am i do anything wrong? Thanks
It is best if you ask this question at Ignite user forum. It requires debugging to get to the bottom of it.
Updating multiple tables inside cursor not working
I have two records in a table A. This helps me to update table 2 however the update is not been applied. This is the SQL code where I added a validation section that allow me to determinate the problem. DECLARE abc CURSOR FOR select d.cod_suc, d.cod_ramo_comercial, d.nro_pol, d.cod_item, d.cod_ramo_tecnico, d.cod_tarifa, d.id_stro, d.nro_stro, d.fec_hora_reclamo, d.fec_aviso, d.fec_registro, d.fec_ingreso_contable, d.txt_place_of_accident, d.id_substro, d.txt_nombre_cober, d.txt_direccion_bien_siniestrado, d.txt_descripcion_perdida, d.txt_cheque_a_nom, d.cod_manager_code, d.importe_pago_eq from table1 d where d.fec_hora_reclamo between '20140801' and '20150731' and (d.cod_suc = 2 and d.cod_ramo_comercial = 255 and d.nro_pol = 1000001 and d.cod_item = 5) OPEN abc FETCH abc INTO #cod_suc, #cod_ramo_comercial, #nro_pol, #cod_item, #cod_ramo_tecnico, #cod_tarifa, #id_stro, #nro_stro, #fec_hora_reclamo, #fec_aviso, #fec_registro, #fec_ingreso_contable, #txt_place_of_accident, #id_substro, #txt_nombre_cober, #txt_direccion_bien_siniestrado, #txt_descripcion_perdida, #txt_cheque_a_nom, #cod_manager_code, #importe_pago_eq WHILE (##FETCH_STATUS = 0) BEGIN select #varIDPV = min(id_pv), #varCodTarifa = min(cod_tarifa) from #portfolio p where p.cod_suc = #cod_suc and p.cod_ramo_comercial = #cod_ramo_comercial and p.Poliza = #nro_pol and p.Item = #cod_item and p.cod_ramo_tecnico = #cod_ramo_tecnico and p.[ID Incident] IS NULL /************************************************************************************************************** -- Validation section -- First record: mid(id_pv) = 100, min(cod_tarifa) = 1 -- Second record: mid(id_pv) = 100, min(cod_tarifa) = 1 --> Should be mid(id_pv) = 100, min(cod_tarifa) = 2 */ select min(id_pv), min(cod_tarifa) from #portfolio p where p.cod_suc = #cod_suc and p.cod_ramo_comercial = #cod_ramo_comercial and p.Poliza = #nro_pol and p.Item = #cod_item and p.cod_ramo_tecnico = #cod_ramo_tecnico and p.[ID Incident] IS NULL /**************************************************************************************************************/ update p set p.[ID Incident] = #id_stro, p.[No. Incident] = #nro_stro, p.[Fecha Accidente] = #fec_hora_reclamo, p.[Fecha Notificacion] = #fec_aviso, p.[Fecha Registro] = #fec_registro, p.[Fecha Pago] = #fec_ingreso_contable, p.[Lugar Accidente] = #txt_place_of_accident, p.[ID Subsiniestro] = #id_substro, p.[Cobertura Amparo] = #txt_nombre_cober, p.[Direccion Bien Siniestrado] = #txt_direccion_bien_siniestrado, p.[Descripcion Perdida] = #txt_descripcion_perdida, p.[Pago A] = #txt_cheque_a_nom, p.[Referida] = #cod_manager_code, [Incurrido R12] = #importe_pago_eq, [Incurrido Cerrados R12] = #importe_pago_eq from #portfolio p where p.cod_suc = #cod_suc and p.cod_ramo_comercial = #cod_ramo_comercial and p.Poliza = #nro_pol and p.Item = #cod_item and p.cod_ramo_tecnico = #cod_ramo_tecnico and p.[ID Incident] IS NULL and p.id_pv = #varIDPV and p.cod_tarifa = #varCodTarifa FETCH abc INTO #cod_suc, #cod_ramo_comercial, #nro_pol, #cod_item, #cod_ramo_tecnico, #cod_tarifa, #id_stro, #nro_stro, #fec_hora_reclamo, #fec_aviso, #fec_registro, #fec_ingreso_contable, #txt_place_of_accident, #id_substro, #txt_nombre_cober, #txt_direccion_bien_siniestrado, #txt_descripcion_perdida, #txt_cheque_a_nom, #cod_manager_code, #importe_pago_eq END CLOSE abc DEALLOCATE abc When I see the result, only the first record is updated.
I found the problem. I forgot to add one condition more in update (inside where). Thanks for the support
WITH clause causing ORA-32044
I have a query which is used in an OBIEE report which erroring out for "ora-32044 while executing recursive WITH query". Tried running in SQL and it is erroring out in there as well. Can anyone take a look at the query and suggest how it can be run without the WITH clause. I have seen examples but without any level, for a case where WITH has been used in the middle of the query, how can it be rewritten without WITH clause so no ora-32044 occurs `SELECT 1 dummy, oh.order_number, ol.line_number, ol.shipment_number, oh.ordered_date, ot.NAME order_type, items.concatenated_segments item, items.description item_description ,bom.assembly_item ,bom.component_item ,bom.implementation_date ,bom.disable_date as date_disabled ,bom.component_item_description ,ol.flow_status_code line_status ,ol.ordered_quantity, ol.shipped_quantity, ol.unit_selling_price, ol.fulfilled_quantity, ol.invoiced_quantity, ol.cancelled_quantity, ol.schedule_ship_date, ol.promise_date, ol.actual_shipment_date, ol.request_date, cust_acct.account_number customer_number, party.party_name customer, ct.trx_number invoice_number, ctl.line_number inv_line_number, ctl.extended_amount, ct.trx_date invoice_date, ct.creation_date invoice_creation_date, wnd.NAME delivery_number, wdd.released_status, hp2.party_name endcustomer, oh.attribute6 business_unit, TO_CHAR (ol.actual_shipment_date, 'MM/YY') shipped_month, TO_CHAR (ol.actual_shipment_date, '"Q"Q YY') shipped_qtr, TO_CHAR (ol.actual_shipment_date, 'YYYY') shipped_year, mc.segment1 product_group, mc.segment2 product_subgroup, items.attribute7 drive_capacity, items.attribute10 drive_form, items.attribute8 drive_speed, items.attribute6 drive_type, items.attribute12 AgileParttype, items.organization_id, case when dis.arithmetic_operator = 'NEWPRICE' then operand when dis.arithmetic_operator = '%' then (ol.unit_selling_price* ol.ordered_quantity)*dis.operand/100.0 else NVL((NVL (ol.pricing_quantity, 0) * NVL (dis.adjusted_amount, 0)),0) end discount_amount FROM apps.oe_order_headers_all oh, apps.oe_order_lines_all ol, apps.wsh_new_deliveries wnd, apps.wsh_delivery_assignments wda, apps.wsh_delivery_details wdd, apps.ra_customer_trx_all ct, apps.ra_customer_trx_lines_all ctl, apps.oe_transaction_types_tl ot, (SELECT * FROM apps.mtl_system_items_vl WHERE organization_id = 84 ) items, apps.hz_parties party, apps.hz_cust_accounts cust_acct, apps.hz_parties hp2, apps.hz_cust_accounts hca2, apps.mtl_item_categories mic, (SELECT * FROM apps.mtl_category_sets WHERE category_set_name = 'Inventory') ms, apps.mtl_categories mc, (select a.header_id, a.line_id ,a.list_header_id,a.creation_date, a.arithmetic_operator,a.unit_selling_price,a.operand, a.ordered_quantity, a.adjusted_amount from (select oh.header_id, ol.line_id,pl.list_header_id,pl.creation_date,opa.arithmetic_operator, ol.unit_selling_price,opa.operand, ol.ordered_quantity, opa.adjusted_amount from apps.oe_price_adjustments opa, apps.oe_order_lines_all ol, apps.oe_order_headers_all oh, apps.qp_list_headers_vl pl where oh.header_id = opa.header_id and ol.line_id = opa.line_id and opa.list_header_id = pl.list_header_id and opa.applied_flag = 'Y' AND opa.list_line_type_code = 'DIS') a, (select oh.header_id, ol.line_id,max(pl.creation_date) creation_date, min(operand) operand from apps.oe_price_adjustments opa, apps.oe_order_lines_all ol, apps.oe_order_headers_all oh, apps.qp_list_headers_vl pl where oh.header_id = opa.header_id and ol.line_id = opa.line_id and opa.list_header_id = pl.list_header_id and opa.applied_flag = 'Y' AND opa.list_line_type_code = 'DIS' group by oh.header_id, ol.line_id) b where a.header_id = b.header_id and a.line_id = b.line_id and a.creation_date = b.creation_date and a.operand = b.operand ) dis ,( WITH recursiveBOM (parent_item_id,parent_item,parent_org_id,assembly_item_id, assembly_item,assembly_org_id, component_item_id,component_item, component_item_description,implementation_date, disable_date) AS ( SELECT item.inventory_item_id parent_item_id ,item.segment1 parent_item ,item.organization_id parent_org_id ,bom.assembly_item_id ,msi.segment1 assembly_item ,bom.organization_id assembly_org_id ,bic.component_item_id ,msi2.segment1 component_item ,msi2.description component_item_description ,bic.implementation_date ,bic.disable_date FROM apps.mtl_system_items_b item, apps.bom_bill_of_materials_v bom, apps.bom_inventory_components_v bic, apps.mtl_system_items msi, apps.mtl_system_items msi2 WHERE 1=1 AND bom.assembly_item_id = item.inventory_item_id AND bom.organization_id = item.organization_id AND bic.bill_sequence_id = bom.common_bill_sequence_id AND msi.inventory_item_id = bom.assembly_item_id AND msi.organization_id = bom.organization_id AND msi2.inventory_item_id = bic.component_item_id AND msi2.organization_id = msi.organization_id AND bic.implementation_date IS NOT NULL AND item.organization_id = 84 AND item.inventory_item_id > 0 UNION ALL SELECT parent.parent_item_id ,parent.parent_item ,parent.parent_org_id ,bom.assembly_item_id ,msi.segment1 assembly_item ,bom.organization_id assembly_org_id ,bic.component_item_id ,msi2.segment1 component_item ,msi2.description component_item_description ,bic.implementation_date ,bic.disable_date FROM recursiveBOM parent, apps.bom_bill_of_materials_v bom, apps.bom_inventory_components_v bic, apps.mtl_system_items msi, apps.mtl_system_items msi2 WHERE 1=1 AND bic.bill_sequence_id = bom.common_bill_sequence_id AND msi.inventory_item_id = bom.assembly_item_id AND msi.organization_id = bom.organization_id AND msi2.inventory_item_id = bic.component_item_id AND msi2.organization_id = msi.organization_id AND bic.implementation_date IS NOT NULL AND bom.assembly_item_id = parent.component_item_id AND bom.organization_id = parent.assembly_org_id AND bom.organization_id = 84 AND parent.assembly_org_id = 84 ) SELECT DISTINCT parent_item_id,parent_item,parent_org_id ,assembly_item_id ,assembly_item ,assembly_org_id ,component_item_id ,component_item ,component_item_description ,implementation_date ,disable_date FROM recursiveBOM ) bom WHERE oh.header_id = ol.header_id AND ol.line_id = wdd.source_line_id AND wdd.source_code = 'OE' AND wda.delivery_detail_id = wdd.delivery_detail_id AND wda.delivery_id = wnd.delivery_id AND ol.line_id = ctl.interface_line_attribute6(+) AND ctl.customer_trx_id = ct.customer_trx_id(+) AND oh.order_type_id = ot.transaction_type_id AND ol.inventory_item_id = items.inventory_item_id AND ol.sold_to_org_id = cust_acct.cust_account_id AND cust_acct.party_id = party.party_id AND oh.end_customer_id = hca2.cust_account_id(+) AND hca2.party_id = hp2.party_id(+) AND items.inventory_item_id = mic.inventory_item_id(+) AND items.organization_id = mic.organization_id(+) AND mic.category_id = mc.category_id(+) AND mic.category_set_id = ms.category_set_id(+) and ol.line_id = dis.line_id(+) and ol.header_id = dis.header_id(+) AND bom.parent_item_id (+) = items.inventory_item_id AND bom.parent_org_id (+) = items.organization_id `