ramm Posted July 26, 2010 Share Posted July 26, 2010 Mysql server version: 5 In database abc_spare1, I'm trying to copy particular columns of data, from phpbb2_posts_text1 into phpbb3_posts3. Specifically, I'm trying to copy the data, from phpbb2_posts_text1's bbcode_uid, post_subject, and post_text columns and insert it into phpbb3_posts3's bbcode_uid, post_subject, and post_text columns. Following is the code I employed: Code: Select all 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; LOOP1: LOOP IF COUNTER1=1 THEN LEAVE LOOP1; 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; // The code appears to run without errors, but I don't see any data showing up in the phpbb3_posts3 columns. I would appreciate if you could tell me how to fix this. - r Link to comment https://forums.phpfreaks.com/topic/208930-no-results/ Share on other sites More sharing options...
fenway Posted July 28, 2010 Share Posted July 28, 2010 Debugging SPs is annoying -- but insert into a dummy log table at every step of the way, and you'll see what's going wrong. Link to comment https://forums.phpfreaks.com/topic/208930-no-results/#findComment-1092022 Share on other sites More sharing options...
ramm Posted July 28, 2010 Author Share Posted July 28, 2010 Looking at my problem, from a different angle, I'm trying to horizontally merge two tables (phpbb2_posts & phpbb2_posts_text) which share a common column (post_id). They exist in the same database and the merger should result in the creation of a new table. I tried adding popbb2_posts' column headings to phpbb2_posts_text and then inserting the data, but, that did not work. So, I tried doing the same with phpbb2_posts_text, but that didn't work, either. I tried going the procedure route, above, but that didn't work. I know it can be done, but I haven't been able to figure it out, yet. phpbb2_posts consists of the following 13 columns: post_id topic_id forum_id poster_id post_time poster_ip post_username enable_bbcode enable_html enable_smilies enable_sig post_edit_time post_edit_count phpbb2_posts_text consists of the following 4 columns: post_id bbcode_uid post_subject post_text Does anyone know to horizontally merge these two tables? - r Link to comment https://forums.phpfreaks.com/topic/208930-no-results/#findComment-1092072 Share on other sites More sharing options...
ramm Posted July 29, 2010 Author Share Posted July 29, 2010 I tried the following code to insert the contents of 3 columns, from phpbb2_posts_text, into 3 columns of phpbb3_posts3. Both tables are located in the same database. Further, phpbb3_posts3's post_id column already exists and sequentially increases, from 2 to 218727. UPDATE phpbb2_posts_text A, phpbb3_posts3 B SET B.bbcode_uid=A.bbcode_uid,B.post_subject=A.post_subject,B.post_text=A.post_text WHERE B.post_id<=218727 Unfortunately, the above code resulted in the following error message: SQL Error (1): Can't create/write to file '/tmp/#sql_4bd9_0.myi' (Errcode:13) I have a feeling that the error is not code-related, but I would appreciate learning your opinion on how to remedy it. Please reply. - r Link to comment https://forums.phpfreaks.com/topic/208930-no-results/#findComment-1092410 Share on other sites More sharing options...
fenway Posted July 29, 2010 Share Posted July 29, 2010 That means your tmpdir is full. Link to comment https://forums.phpfreaks.com/topic/208930-no-results/#findComment-1092567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.