Forum » Programiranje » [SQL] DB2 Create Trigger Napaka
[SQL] DB2 Create Trigger Napaka
Mani ::
Podravljeni,
zanima me ce kdo ve kaj je narobe v tem sql statementu.
Rad bi naredil triger ki se sprozi ob deletu in naredi insert na novo tabelo.
Tabeli sta identicni. Iz WLFPRICAT v TLFPRICAT.
Javi mi napako:
AN ERROR OCCURRED WHEN BINDING A TRIGGERED SQL STATEMENT. INFORMATION RETURNED: SECTION NUMBER : 2 SQLCODE -797, SQLSTATE 42987, AND MESSAGE TOKENS TI106501. SQLCODE=-20100, SQLSTATE=56059, DRIVER=4.17.30
Koda:
CREATE TRIGGER TI106501
NO CASCADE BEFORE DELETE ON WLFPRICAT
REFERENCING OLD AS LFPRICAT
FOR EACH ROW MODE DB2SQL
NOT SECURED
WHEN (LFPRICAT.ROW_ID13 NOT IN (SELECT ROW_ID13 FROM WLFPRICAT))
INSERT INTO TLFPRICAT
VALUES (LFPRICAT.LIEFERANTENNUMMER,
LFPRICAT.EINKAUFSNUMMER,
LFPRICAT.LIEFERANTEN_EAN,
LFPRICAT.LIEF_ART_NUM20,
LFPRICAT.LIEF_FARBEN_BEZ35,
LFPRICAT.FARBCODE35,
LFPRICAT.WAREN_GROESSE35,
LFPRICAT.WAEHRUNGS_CODE3,
LFPRICAT.LFD_POSIT_NUM,
LFPRICAT.TEXT_AUZE_FIX,
LFPRICAT.TEXT_AUZE_VAR,
LFPRICAT.REGAL_TEXT,
LFPRICAT.MODELL_BEZ,
LFPRICAT.KZ_URSPRUNGSLAND,
LFPRICAT.EINKAUFSPREIS15,
LFPRICAT.EMPFOHL_VK_PREIS15,
LFPRICAT.HW_EDI_ORDER,
LFPRICAT.KZ_DATENTRANSFER,
LFPRICAT.DATE_GUELTIG_VON,
LFPRICAT.DATE_GUELTIG_BIS,
TLFPRICAT.TIST_AENDERUNG,
LFPRICAT.USER_AENDERUNG,
LFPRICAT.DATE_ERFASSUNG,
LFPRICAT.USER_ERFASSUNG,
LFPRICAT.LIEF_VERPACKART,
LFPRICAT.LIEF_WARENGRUPPE,
LFPRICAT.LIEF_SAISON,
LFPRICAT.LIEF_MIN_BEST_MG);
zanima me ce kdo ve kaj je narobe v tem sql statementu.
Rad bi naredil triger ki se sprozi ob deletu in naredi insert na novo tabelo.
Tabeli sta identicni. Iz WLFPRICAT v TLFPRICAT.
Javi mi napako:
AN ERROR OCCURRED WHEN BINDING A TRIGGERED SQL STATEMENT. INFORMATION RETURNED: SECTION NUMBER : 2 SQLCODE -797, SQLSTATE 42987, AND MESSAGE TOKENS TI106501. SQLCODE=-20100, SQLSTATE=56059, DRIVER=4.17.30
Koda:
CREATE TRIGGER TI106501
NO CASCADE BEFORE DELETE ON WLFPRICAT
REFERENCING OLD AS LFPRICAT
FOR EACH ROW MODE DB2SQL
NOT SECURED
WHEN (LFPRICAT.ROW_ID13 NOT IN (SELECT ROW_ID13 FROM WLFPRICAT))
INSERT INTO TLFPRICAT
VALUES (LFPRICAT.LIEFERANTENNUMMER,
LFPRICAT.EINKAUFSNUMMER,
LFPRICAT.LIEFERANTEN_EAN,
LFPRICAT.LIEF_ART_NUM20,
LFPRICAT.LIEF_FARBEN_BEZ35,
LFPRICAT.FARBCODE35,
LFPRICAT.WAREN_GROESSE35,
LFPRICAT.WAEHRUNGS_CODE3,
LFPRICAT.LFD_POSIT_NUM,
LFPRICAT.TEXT_AUZE_FIX,
LFPRICAT.TEXT_AUZE_VAR,
LFPRICAT.REGAL_TEXT,
LFPRICAT.MODELL_BEZ,
LFPRICAT.KZ_URSPRUNGSLAND,
LFPRICAT.EINKAUFSPREIS15,
LFPRICAT.EMPFOHL_VK_PREIS15,
LFPRICAT.HW_EDI_ORDER,
LFPRICAT.KZ_DATENTRANSFER,
LFPRICAT.DATE_GUELTIG_VON,
LFPRICAT.DATE_GUELTIG_BIS,
TLFPRICAT.TIST_AENDERUNG,
LFPRICAT.USER_AENDERUNG,
LFPRICAT.DATE_ERFASSUNG,
LFPRICAT.USER_ERFASSUNG,
LFPRICAT.LIEF_VERPACKART,
LFPRICAT.LIEF_WARENGRUPPE,
LFPRICAT.LIEF_SAISON,
LFPRICAT.LIEF_MIN_BEST_MG);
Pomagajmo si med samo :)
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
- spremenil: Mani ()
OracleDev ::
Pomojem je narobe že to da v BEFORE triggerju ne morš uporabljat vrednosti, ki še niso insertirane oz. brisane.
Probi kreirat AFTER trigger.
Probi kreirat AFTER trigger.
Mani ::
Tabela WLFPRICAT vsebuje te podatke kateeri bi bili premaknjeni v tabelo TLFPRICAT.
Z AFTER bi moral verjetno narediti temporary tabelo ali gre brez?
Z AFTER bi moral verjetno narediti temporary tabelo ali gre brez?
Pomagajmo si med samo :)
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
Mani ::
Zadevo resil z AFTER. Hvala za nasvet!
CREATE TRIGGER DEL_TRIGER_DEL
AFTER DELETE ON WLFPRICAT
REFERENCING OLD AS LFPRICAT
FOR EACH ROW MODE DB2SQL
INSERT INTO TLFPRICAT
VALUES (LFPRICAT.LIEFERANTENNUMMER,
LFPRICAT.EINKAUFSNUMMER,
LFPRICAT.LIEFERANTEN_EAN,....
CREATE TRIGGER DEL_TRIGER_DEL
AFTER DELETE ON WLFPRICAT
REFERENCING OLD AS LFPRICAT
FOR EACH ROW MODE DB2SQL
INSERT INTO TLFPRICAT
VALUES (LFPRICAT.LIEFERANTENNUMMER,
LFPRICAT.EINKAUFSNUMMER,
LFPRICAT.LIEFERANTEN_EAN,....
Pomagajmo si med samo :)
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
KUCOIN Exchange: https://www.kucoin.com/#/?r=1bf2f
BINANCE Exchange: https://www.binance.com/?ref=16629068
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | oracle 12 identity (the old way)Oddelek: Programiranje | 1053 (858) | detroit |
» | UPDATE INTO v sam vnos zapisa (MYSQL)Oddelek: Programiranje | 861 (648) | SynTax64 |
» | vb mysql dataset updateOddelek: Programiranje | 1235 (1115) | korenje3 |
» | SQL trigger OracleOddelek: Programiranje | 1167 (1075) | PunXXX |
» | postgreSQL triggerOddelek: Programiranje | 1477 (1387) | WarpedGone |