distal-attribute
distal-attribute
distal-attribute
distal-attribute

Procedure Question

jamsession posted 4 years ago in General
Through Heidisql, I'm trying to copy certain columns of data, in one table, and insert them into another table.

Both tables are in the same database, abc_spare1.

So, I created the following code for the task.

It seems to run without error, but I have not, yet, seen any new data in the second table.

So, I was wondering if the code was missing something that Heidisql needed.

Is that the case?

Following is that code:


delimiter //
use abc_spare1;
CREATE PROCEDURE Getdata1()
BEGIN
DECLARE COUNTER1 INT DEFAULT 0;
DECLARE bbcode_uid VARCHAR(10);
DECLARE post_subject VARCHAR(60);
DECLARE post_text TEXT;
DECLARE CUR CURSOR FOR SELECT * FROM phpbb2_posts_text1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET COUNTER1=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' SET COUNTER1=1;
OPEN cur;
lbl: LOOP
IF COUNTER1=1 THEN
LEAVE lbl;
END IF;
IF NOT COUNTER1=1 THEN
FETCH CUR INTO bbcode_uid,post_subject,post_text;
INSERT INTO phpbb3_posts3 VALUES(bbcode_uid,post_subject,post_text);
END IF;
END LOOP;
CLOSE cur;
END;
//


Please reply.

- j

Please login to leave a reply, or register at first.