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

Discussion in 'MySQL' started by amit_27, May 19, 2009.

  1. amit_27

    amit_27 New Member

    Joined:
    May 19, 2009
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. fashionbop

    fashionbop New Member

    Joined:
    Sep 11, 2009
    Messages:
    27
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Shopping from China
    Location:
    Guangzhou, China
    Home Page:
    http://www.fashion-bop.com
    Re: Trigger Error - ERROR 1415 (0A000): Not allowed to return a result set from a tri

    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!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice