Afficher un message
Vieux 23/12/2007, 21h04   #1
Bruno Panetta
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to check in a stored proc if data is already present?

I have a stored proc like the following. It works on a table called
ProductType with only one field, called ProductTypeName.

DROP PROCEDURE IF EXISTS myDB.setProductType;
CREATE PROCEDURE myDB.`setProductType`(

IN ProductType VARCHAR(20))
BEGIN
INSERT INTO ProductType
(
ProductTypeName
)
VALUES
(
ProductTypeName );
END;

It works fine, but I would like to avoid duplicates. How can I make
the stored proc check if that ProductTypeName is already in the table,
and only insert it if it's not? Thanks.
  Réponse avec citation
 
Page generated in 0,04360 seconds with 9 queries