Hallo,
Habe folgende kleine Tabellen:
SQL-Code:
CREATE TABLE COUNTER (BUFFERSIZE INTEGER);
CREATE GENERATOR GEN_XMLBUFFER_ID;
CREATE TABLE XMLBUFFER (
ID INTEGER NOT NULL,
TIMEDATE TIMESTAMP,
DATA BLOB SUB_TYPE 1 SEGMENT SIZE 80
);
ALTER TABLE XMLBUFFER ADD CONSTRAINT PK_XMLBUFFER PRIMARY KEY (ID);
CREATE INDEX XMLBUFFER_TIME ON XMLBUFFER (TIMEDATE);
SET TERM ^ ;
CREATE OR ALTER TRIGGER XMLBUFFER_BD0 FOR XMLBUFFER
ACTIVE BEFORE DELETE POSITION 0
AS
begin
Update Counter set BufferSize = BufferSize - 1;
end
^
CREATE OR ALTER TRIGGER XMLBUFFER_BI FOR XMLBUFFER
ACTIVE BEFORE INSERT POSITION 0
as
begin
Update Counter set BufferSize = BufferSize + 1;
if (new.id is null) then
new.id = gen_id(gen_xmlbuffer_id,1);
end
^
SET TERM ; ^
'COUNTER' enthält die Anzahl der Datensätze in der Tabelle 'XMLBUFFER'.
So, nun will ich die Tabelle 'XMLBUFFER' verkleinern. Dazu schnippel ich die ältesten 500 Records weg:
SQL-Code:
delete from xmlbuffer
where id in (
select first 500 id from xmlbuffer
)
Leider klappt das nie, denn ich bekomme jedesmal den Fehler:
Zitat:
Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements.
lock conflict on no wait transaction.
deadlock.
update conflicts with concurrent update.
concurrent transaction number is 1799580.
At trigger 'XMLBUFFER_BD0' line: 5, col: 4.
Kann man das vermeiden, ohne die Trigger zu löschen, oder muss man damit leben?