Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MySQL (http://www.go4expert.com/forums/mysql-forum/)
-   -   Error Code: 1415. Not allowed to return a result set from a trigger (http://www.go4expert.com/forums/error-code-1415-allowed-return-result-t26204/)

ying7690 4Jul2011 08:42

Error Code: 1415. 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;

ying7690 4Jul2011 08:46

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;


shabbir 4Jul2011 09:26

Re: Error Code: 1415. Not allowed to return a result set from a trigger
 
Please don't create two separate threads and I have merged both of them for you.

ying7690 4Jul2011 09:27

Re: Error Code: 1415. Not allowed to return a result set from a trigger
 
thanks.because i cant remove the previous thread...


All times are GMT +5.5. The time now is 07:20.