473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MySQL continue handler for 1329 not working.please help..the SP hangs

DELIMITER $$

USE `tsmakersmark`$$

DROP PROCEDURE IF EXISTS `LoadProductImages`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `LoadProductImages`(pmerchant_id VARCHAR(200))
BEGIN

DECLARE int_no_of_rec VARCHAR(30);
DECLARE Retdonep INT DEFAULT 0;
DECLARE no_of_rec INT DEFAULT 0;
DECLARE RetCsrSTYLE_SID VARCHAR(20);
DECLARE RetCsrITEM_SID VARCHAR(20);
DECLARE RetCsrDESCRIPTION4 VARCHAR(20);
DECLARE prodid INT(10);
DECLARE errormessage VARCHAR(200);
DECLARE RetCsrProductStyle CURSOR FOR SELECT DISTINCT STYLE_SID FROM retailprotoweb.osinvn_sbs WHERE MERCHANTID=pmerchant_id ;
DECLARE CONTINUE HANDLER FOR 02000 SET Retdonep = 1;
DECLARE CONTINUE HANDLER FOR 1329 SET @error=1;

SET @error=0;

OPEN RetCsrProductStyle;
REPEAT

FETCH RetCsrProductStyle INTO RetCsrSTYLE_SID;



IF NOT Retdonep THEN



IF RetCsrSTYLE_SID IS NOT NULL AND RetCsrSTYLE_SID != '' THEN

-- select DESCRIPTION4 into RetCsrDESCRIPTION4 from retailprotoweb.osinvn_sbs WHERE STYLE_SID = RetCsrSTYLE_SID AND MERCHANTID=pmerchant_id;
/*
set no_of_rec = (SELECT 1 FROM retailprotoweb.osinvn_sbs osbs,retailprotoweb.osinvn_image oi WHERE osbs.ITEM_SID = oi.ITEM_SID AND IMAGE100 IS NOT NULL AND IMAGE300 IS NOT NULL AND osbs.MERCHANTID= pmerchant_id AND osbs.STYLE_SID = RetCsrSTYLE_SID LIMIT 0,1);
IF (@error>0) THEN
CASE @error
WHEN '1' THEN SET errormessage='No data found';

END CASE;
select 1;
-- INSERT INTO retailprotoweb.osdcserrorlog SELECT *,NOW(),errormessage FROM retailprotoweb.osdcs WHERE DCS_CODE=RetCsrDCSCODE;
END IF;
-- SET int_no_of_rec = (select * from ts_product);


if no_of_rec > 0 and no_of_rec is not null and no_of_rec!='' then

INSERT INTO tsmakersmark.mylogs(c1,c2,c3,c4) VALUES('no_of_rec',no_of_rec,RetCsrSTYLE_SID,'insi de if');

set RetCsrITEM_SID='';

SELECT oi.ITEM_SID INTO RetCsrITEM_SID FROM retailprotoweb.osinvn_sbs osbs,retailprotoweb.osinvn_image oi WHERE osbs.ITEM_SID = oi.ITEM_SID AND IMAGE100 IS NOT NULL AND IMAGE300 IS NOT NULL AND osbs.MERCHANTID= pmerchant_id AND osbs.STYLE_SID = RetCsrSTYLE_SID LIMIT 0,1;

-- INSERT INTO prestashop.mylogs(c2)VALUES(RetCsrDESCRIPTION4);



-- select getImageSID(RetCsrSTYLE_SID,pmerchant_id) into RetCsrITEM_SID;

IF RetCsrITEM_SID IS NOT NULL AND RetCsrITEM_SID != '' and RetCsrITEM_SID != 0 THEN

SET prodid = 0;
SET @pImgChk=0; -- Added Now
SET @pName=''; -- Added Now

SELECT id_product INTO prodid FROM ts_product WHERE reference = RetCsrSTYLE_SID ;

SELECT @pName:= NAME FROM ts_product_lang WHERE id_product = prodid AND id_lang = 1 ;

SELECT @pImgChk := id_image FROM ts_image WHERE id_product = prodid;

-- IF prodid IS NOT NULL AND prodid != "" THEN
IF prodid > 0 THEN -- added now

-- INSERT INTO prestashop.mylogs(c1,c2,c3,c4,c5)VALUES(RetCsrSTYL E_SID,RetCsrDESCRIPTION4,@pName,prodid,@ImageId);
-- INSERT INTO retailprotoweb.osinvn_image_mapping(ITEM_SID,STYLE _SID,Product_ID,ImageID,MERCHANTID,Date_Created,Da te_Updated)VALUES('',RetCsrSTYLE_SID,prodid,@Image Id,pmerchant_id,NOW(),NOW());


IF @pImgChk >0 THEN


SELECT 1;
UPDATE retailprotoweb.osinvn_image_mapping SET Date_Updated = NOW() WHERE STYLE_SID = RetCsrSTYLE_SID AND Product_ID = prodid AND ImageID = @ImageId AND MERCHANTID = pmerchant_id;

ELSE

INSERT INTO ts_image(id_product,POSITION,cover) VALUES(prodid,1,1);

SET @ImageId=''; -- Added Now

SELECT @ImageId := MAX(id_image) FROM ts_image; -- Fetch previously inserted Image Id.

INSERT INTO ts_image_lang(id_image,id_lang,legend) VALUES(@ImageId,1,@pName);

INSERT INTO retailprotoweb.osinvn_image_mapping(ITEM_SID,STYLE _SID,Product_ID,ImageID,MERCHANTID,Date_Created,Da te_Updated)VALUES(RetCsrITEM_SID,RetCsrSTYLE_SID,p rodid,@ImageId,pmerchant_id,NOW(),NOW());

END IF; -- for @pImgChl ..

END IF; -- for prodid
END IF; -- RetCsrITEM_SID

else -- no_or_rec
select 1;
end if; -- no_or_rec

*/

SELECT 1;

ELSE

SELECT 1;

END IF; -- end of RetCsrSTYLE_SID


END IF; -- end of retdone



UNTIL Retdonep END REPEAT;
CLOSE RetCsrProductStyle;


END$$

DELIMITER ;
Aug 14 '10 #1
0 1178

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Chris Michael | last post by:
Hello everybody, Newbie here. I've been working on this for the last two days and I can't figure out where this problem is. I think it's something so obvious, but I can't see it! OK, firstly...
1
by: MultiTaskinG | last post by:
I want to retrieve all comment stored from my web users ordered BY THREAD and BY TIMESTAMP (INT 11) with a single query (if is possible) now I launch this query: SELECT thread, timestamp,...
1
by: Richard Holliingsworth | last post by:
Hello: Thanks for reading this. We just converted to A2002 and some of my querries have stopped working and I can't figure out why. Basically, anything with a "NOT" is not working. For...
11
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very...
3
by: JJ | last post by:
I am a newbie to mySQL. I am developing an ASP .net Web site with mySQL as the database (of products), using vb .net 2003. Can anyone point me in the direction of a good book (or in fact ANY book)...
1
by: Chris | last post by:
ASP.NET 2.0 was working fine, then I installed XP SP2 an it stopped working. Unfortunately I do need SP2 so going back to SP1 is not an option. I am quite certain that it was working for a while...
3
by: Snt | last post by:
Hi! I am trying to get AJAX working on multiple browsers and am having a problem with Firefox. I have the following code: function handleState3(){ switch(http.readyState) { case 0: //...
2
by: daniell | last post by:
Please help with this code. I am unable to figure out what's wrong with it. The purpose of this code is to copy data from one record into an infinite amount of records. For example if there were...
6
by: backups2007 | last post by:
Here's my code. For some reason, it's not working. Please help... Thank you. <? $so_no=$_POST; //customer type $ctype=$_POST; //customer info $cust_id=$_POST; $walkin_id=$_POST;
1
by: hitlerassdome | last post by:
why this code is not working please help. thanks my $count = 0; $count = $dbh->do("INSERT INTO ques...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.