Программирование >>  Построение запросов sql 

1 ... 97 98 99 [ 100 ] 101


INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES (6,

080613, 1, 6, 06/16/2001, 06/24/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES (7,

080047, 3, 2, 10/20/1998, 10/24/1998, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES (9,

136169, 2, 1, 11/06/2001, 11/08/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(10, 136159, 3, 12, 04/01/2001, 04/03/2001, 0);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(11, 136160, 1, 6, 01/12/1999, 01/12/1999, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(12, 443069, 5, 4, 08/08/2001, 08/10/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(13, 005488, 5, 8, 09/04/2000, 12/05/2000, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(14, 005488, 4, 6, 04/04/1999, 04/13/1999, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(15, 115705, 4, 5, 09/20/2000, 09/23/2000, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(16, 115705, 2, 3, 12/28/2001, NULL, 0);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(17, 115705, 1, 5, 08/15/2001, 09/06/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(18, 115705, 2, 3, 12/28/1999, 01/04/2000, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(19, 080270, 4, 8, 12/17/2001, 12/27/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(20, 080047, 3, 2, 10/11/2001, 10/11/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(21, 443069, 1, 2, 09/13/2001, 09/14/2001, 1);



INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(22, 136160, 1, 7, 05/18/2001, 05/25/2001, 1);

INSERT INTO REQUEST (REQUESTCD, ACCOUNTCD, EXECUTORCD, FAILURECD, INCOMINGDATE, EXECUTIONDATE, EXECUTED) VALUES

(23, 136169, 5, 7, 05/07/2001, 05/08/2001, 1);

COMMIT WORK;

/i /

/* Triggers */

/i /

SET TERM ;

CREATE TRIGGER TDABONENT FOR ABONENT ACTIVE AFTER DELETE POSITION 0

DECLARE VARIABLE NUMROWS INTEGER; BEGIN

SELECT COUNT(*) FROM NACHISLSUMMA

WHERE

NACHISLSUMMA.ACCOUNTCD = OLD.ACCOUNTCD INTO

NUMROWS;

IF (NUMROWS > 0) THEN

BEGIN

EXCEPTION DelRestrict;

SELECT COUNT(*) FROM PAYSUMMA

WHERE

PAYSUMMA.ACCOUNTCD = OLD.ACCOUNTCD INTO NUMROWS; IF (NUMROWS > 0) THEN

BEGIN

EXCEPTION DelRestrict;

END END

CREATE TRIGGER TDSERVICES FOR SERVICES ACTIVE AFTER DELETE POSITION 0

DECLARE VARIABLE NUMROWS INTEGER; BEGIN

SELECT COUNT(*) FROM NACHISLSUMMA

WHERE

NACHISLSUMMA.GAZSERVICECD = OLD.GAZSERVICECD INTO

NUMROWS;



IF (NUMROWS > 0) THEN

BEGIN

EXCEPTION DelRestrict;

SELECT COUNT(*) FROM PAYSUMMA

WHERE

PAYSUMMA.GAZSERVICECD = OLD.GAZSERVICECD INTO

NUMROWS; IF (NUMROWS > 0) THEN BEGIN

EXCEPTION DelRestrict;

END END

SET TERM ; л



1 ... 97 98 99 [ 100 ] 101

© 2006 - 2024 pmbk.ru. Генерация страницы: 0
При копировании материалов приветствуются ссылки.
Яндекс.Метрика