Trigger Error - ERROR 1415 (0A000): Not allowed to return a result set from a trigger

amit_27's Avatar, Join Date: May 2009
Go4Expert Member
Hi,

I have created a trigger which is giving me an error "ERROR 1415 (0A000): Not allowed to return a result set from a trigger":
Code:
CREATE TABLE t1(idencol INT AUTO_INCREMENT,DUMMYCOL INT NOT NULL, PRIMARY KEY(CLIDENTCOL));
GO;
CREATE TRIGGER tri1 BEFORE INSERT ON t2
FOR EACH ROW
BEGIN
DECLARE PN INT; 
DECLARE TAB_COLU VARCHAR(10); 
DECLARE done INT DEFAULT 0;
DECLARE TRG_CURSOR CURSOR FOR SELECT FNAME FROM INSERTED; 
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN TRG_CURSOR;

REPEAT
FETCH TRG_CURSOR INTO TAB_COL;    
   IF NOT done THEN
     BEGIN 
    DELETE FROM amit.t1 WHERE DUMMYCOL = 0;
    INSERT INTO amit.t1 (DUMMYCOL) VALUES(0);
    SELECT @PN = @@IDENTITY; 
    INSERT INTO amit.CLtable VALUES (@SynchPointNumber, 14);
    INSERT INTO amit.CLMtable VALUES (TAB_COL, @PN, 'I');
      END;
   END IF;
UNTIL done END REPEAT;

CLOSE TRG_CURSOR;
END
$

As I am newbie to MySQL not cleared about where it is indicating.
jstf's Avatar, Join Date: Sep 2010
Light Poster
I suggest you to check your trigger'snytax ,sometimes wrong triggers'spelling also can cause this error! And you'd better show tables related to the table t1 and t2!