Click here to Skip to main content
16,017,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my Project there is a requirement to write a trigger on a Table (eis_batchmessage) having columns (Id,userids,Mobiles,Message,MarylinID,Processed,TableNumber).
The column userids,Mobiles,MarylinID contains multiple value separated by comma like

for userid is : "1427,4589,2358"
for Mobiles is : "91992673545,9176635522,9176342322"

I have another table (mymessage) having columns (id,userid,mobiles,message,marylinid)

When data insert into eis_batchmessage then after insert trigger will fire and comma separate value will split and insert into the mymessage table.

Can anybody help me to write/complete my trigger. I am facing problem in spiting the value and inserting.

My so far code is below
SQL
create trigger ins_BachProcess_trig after insert on eis_batchmessage
for each row
BEGIN
Select NEW.Id, NEW.userids, NEW.Mobiles, NEW.Message, NEW.MarylinID, NEW.Processed, NEW.TableNumber from eis_batchmessage;
call InsertBatch()
END;



CREATE PROCEDURE InsertBatch()
BEGIN

DECLARE cur1 CURSOR FOR  Id,userids,Mobiles,Message,MarylinID,Processed,TableNumber from eis_batchmessage

DECLARE v_id BIGINT;
DECLARE v_userid TEXT;
DECLARE v_Mobiles TEXT;
DECLARE v_Message varchar(260);
DECLARE v_Marylinid BIGINT;
DECLARE v_processed INT;
DECLARE v_tableno INT;

OPEN cur1;


CLOSE cur1;

END
Posted
Updated 10-Oct-11 8:51am
v2

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900