MySQL Forums
Forum List  »  Triggers

help!! with Secuence field (autonumeric)
Posted by: axel lope
Date: April 17, 2005 04:20PM

i try to create an autonumeric field, with select max for the pk field
but when y try to insert in this table return this error
ERROR 1100 (HY000): Table 'ALM_PROVEEDORES' was not locked with LOCK TABLES

what is the problem?

thanks....

CREATE TRIGGER TRG_PROV_BINSERT
BEFORE INSERT ON ALM_PROVEEDORES
FOR EACH ROW
BEGIN
DECLARE N INT;
SELECT ifnull(max(PRO_CORReLATIVO),0)+1 INTO N FROM
almacen.ALM_PROVEEDORES LIMIT 1;

SET NEW.PRO_CORRELATIVO = N;

END;

Options: ReplyQuote


Subject
Views
Written By
Posted
help!! with Secuence field (autonumeric)
3964
April 17, 2005 04:20PM


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.