1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error Code: 1415. Not allowed to return a result set from a trigger

Discussion in 'MySQL' started by ying7690, Jul 4, 2011.

  1. ying7690

    ying7690 New Member

    Joined:
    Jul 4, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    I have the following code for trigger
    the syntax message was

    "Error Code: 1415. Not allowed to return a result set from a trigger"

    Code:
    delimiter $$   CREATE TRIGGER  New_User AFTER INSERT ON  tblAdmin   FOR EACH ROW  BEGIN  DECLARE _AdminRECID char(36);  DECLARE _CreateUser varchar(50);  DECLARE _CreateDate datetime;  DECLARE _AuditUser varchar(50);  DECLARE _AuditDate datetime;  DECLARE _MenuRECID CHAR(36);   SELECT RECID = _AdminRECID, 	    CreateUser = _CreateUser, 	    CreateDate = _CreateDate, 	    AuditUser  = _AuditUser, 	    AuditDate  = _AuditDate  FROM tblAdmin;    SELECT RECID = _MenuRECID FROM tblMenu;    	  INSERT INTO tblAdmin_Access(RECID,AdminRECID,MenuRECID,Status,   CreateUser,CreateDate,AuditUser,AuditDate) 	 VALUES (UUID(),_AdminRECID,_MenuRECID,'A', _CreateUser,CURDATE(),_AuditUser,CURDATE());     END;
     
  2. ying7690

    ying7690 New Member

    Joined:
    Jul 4, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Not allowed to return a result set from a trigger

    I have the following code for trigger
    the syntax message was

    "Error Code: 1415. Not allowed to return a result set from a trigger"

    Code:
    delimiter $$
    
    CREATE TRIGGER  New_User AFTER INSERT ON  tblAdmin
    
    FOR EACH ROW
    BEGIN
    DECLARE _AdminRECID char(36);
    DECLARE _CreateUser varchar(50);
    DECLARE _CreateDate datetime;
    DECLARE _AuditUser varchar(50);
    DECLARE _AuditDate datetime;
    DECLARE _MenuRECID CHAR(36);
    
    SELECT RECID = _AdminRECID,
           CreateUser = _CreateUser,
           CreateDate = _CreateDate,
           AuditUser  = _AuditUser,
           AuditDate  = _AuditDate
    FROM tblAdmin;
    
    SELECT RECID = _MenuRECID
    FROM tblMenu;
    
    
    
        INSERT INTO tblAdmin_Access(RECID,AdminRECID,MenuRECID,Status,CreateUser,CreateDate,AuditUser,AuditDate)
        VALUES (UUID(),_AdminRECID,_MenuRECID,'A',_CreateUser,CURDATE(),_AuditUser,CURDATE());
    
    
    END;
    
    
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    Please don't create two separate threads and I have merged both of them for you.
     
  4. ying7690

    ying7690 New Member

    Joined:
    Jul 4, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    thanks.because i cant remove the previous thread...
     

Share This Page