I have a Stored Procedure written which inserts values from Table 1 to Table 2. Now, a trigger (AFTER INSERT) is created on Table 1 and is made to call the above Stored Procedure. The above scenario is working fine. But what I wanted to achieve is that when one row from T1 is getting inserted into T2 then I want the same row to be deleted from T1. I tried using delete statement but MySQL doesn't allow the same.
Here is my current trigger:
DELIMITER $$
CREATE TRIGGER `ins` AFTER INSERT ON `T1`
FOR EACH ROW
BEGIN
CALL sp();
END;
$$
In SP I have the line Delete from T1 where ID = sb; (This is creating problem) In T1 there is a ID field as PK ans in T2 there is an RID field both are used for referencing purpose.