0

Hi.

i have a Stored Procedure like this

DELIMITER $$

DROP PROCEDURE IF EXISTS `foundation`.`TEMP_TBL` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `TEMP_TBL`()
BEGIN

-- DROP TABLE IF EXISTS TEMP_TBL;

DECLARE done int(10);
DECLARE a,b,c,cname CHAR(26);


-- DECLARE cur1 CURSOR FOR SELECT id,ccode,accname FROM account_master;


DECLARE cursor1 CURSOR FOR
SELECT id,ccode,accname FROM account_master;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;

CREATE TEMPORARY TABLE TEMP_TBL1 (
id int(20) ,
ccode int(50) ,
accname varchar(50)
);

open cursor1;

REPEAT

FETCH cursor1 INTO a, b,c;

insert into TEMP_TBL1 values(a,b,c);

UNTIL done END REPEAT;

close cursor1;

open cursor1;

REPEAT

FETCH cursor1 INTO a, b,c;

block2:begin

DECLARE cursor2 cursor FOR SELECT cname FROM client_master where id=a and delflag=0;


open cursor2;
FETCH cursor2 INTO cname;
close cursor2;

update TEMP_TBL1 set ccode=cname where id=a;
end block2;

-- update TEMP_TBL1 set ccode=cname where id=a;

UNTIL done END REPEAT;

close cursor1;

select * from TEMP_TBL1;

DROP TABLE TEMP_TBL1;


END $$

DELIMITER ;

here i have Cursor1 and cursor2.And i want to Update the TEMP_TBL1 based on the Cursor2 information .
But it's not updateing.can any one help me how to do this.
i want like this method only i don't want to use the JOIN concept.

how to update the TEMP_TBL1 data.?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by rch1231
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.