MySQL Forums
Forum List  »  Triggers

Trigger to reset auto increment after the table empty
Posted by: Rusdy Perkasa
Date: April 25, 2014 12:55AM

hi, i am new to mysql and is processsing to migrate from firebird to mysql.
can anyone help me create for my case
i want to create trigger
to reset autoincrement after emptying row on table
and this trigger event is on delete row
this my trigger syntax on firebird :

DECLARE VARIABLE L_VARIABLE INTEGER;
BEGIN
SELECT FIRST 1
ID
FROM
JENISJURNAL
INTO
:L_VARIABLE;

IF (L_VARIABLE IS NULL) THEN
EXECUTE STATEMENT 'ALTER SEQUENCE GEN_JENISJURNAL_ID RESTART WITH 0';
END;

i already try on mysql but always show error

thx

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger to reset auto increment after the table empty
3899
April 25, 2014 12:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.