You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TABLE PARCELASVENDAS (
ID DMID NOT NULL,
IDVENDA DMID NOT NULL,
NUMERO INTEGER,
DATAVENCTO DMDATA,
VALOR DMNUMERICO,
STATUS VARCHAR(10) CHARACTER SET ISO8859_1 COLLATE ISO8859_1,
USUARIO DMUSUARIO,
DHINCLUSAO DMDHINCLUSAO,
DHMODIFICACAO DMDHMODIFICACAO,
"CHECK" DMBOLEANO);
ALTER TABLE PARCELASVENDAS ADD CONSTRAINT PK_PARCELASVENDAS PRIMARY KEY (ID);
ALTER TABLE PARCELASVENDAS ADD CONSTRAINT FK_PARCELASVENDASVENDAS FOREIGN KEY (IDVENDA) REFERENCES VENDAS(ID) ON DELETE CASCADE ON UPDATE CASCADE;
SET TERM ^ ;
CREATE TRIGGER PARCELASVENDAS_BI FOR PARCELASVENDAS
ACTIVE BEFORE INSERT
POSITION 1
AS
BEGIN
IF (NOT EXISTS(SELECT ID FROM PARCELASVENDAS WHERE ID = NEW.ID
AND IDVENDA = NEW.IDVENDA AND "CHECK" = 'N')) THEN
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(PARCELASVENDAS_ID_GEN, 1);
NEW.DHINCLUSAO = 'NOW';
NEW.DHMODIFICACAO = 'NOW';
NEW."CHECK" = 'N';
END
ELSE
EXCEPTION REGISTROJAEXISTE;
END^
CREATE TRIGGER PARCELASVENDAS_BU FOR PARCELASVENDAS
ACTIVE BEFORE UPDATE
POSITION 1
AS
BEGIN
NEW.DHMODIFICACAO = 'NOW';
END^
SET TERM ; ^
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: