MySQL Forums
Forum List  »  Stored Procedures

Re: Thread_overrun error
Posted by: Caner YILMAZ
Date: February 07, 2014 03:29AM

Caner YILMAZ Wrote:
-------------------------------------------------------
> in loop
> (total result in a veriable)-(information in a
> row)=new result
> (new result)-(information in a row)=new result
>
> etc...
>
> I'm trying to do this heck

---------

CREATE PROCEDURE fetchyapisi(title VARCHAR(60))
BEGIN

DECLARE loanSum DOUBLE;
DECLARE fetch_agreed_amount BIGINT DEFAULT 0;
DECLARE not_found_credit INT DEFAULT 0;
DECLARE balance DOUBLE DEFAULT 0;

SET @id:=(SELECT account_id from jaces_involvedparty where `name`=title limit 1,1);

delete from jaces_fieldmark where account_id=@id;

insert INTO jaces_fieldmark(account_id,order_id,totalSum)
SELECT account1_id,id,agreed_amount from jaces_usap where account1_id=@id
and transaction_def_id=1 and creation_date BETWEEN '2013-01-01' and '2014-02-02' GROUP BY id DESC;

SET loanSum:=(select SUM(loan) from jaces_daybook where account_id=@id
and active=1 AND transaction_date BETWEEN '2013-01-01' and '2014-02-04');

BEGIN
DECLARE siparis CURSOR FOR
SELECT total_sum from jaces_fieldmark;

DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found_credit = 1;

OPEN siparis;

SET not_found_credit = 0;

get_list: LOOP
FETCH siparis INTO fetch_agreed_amount;

SET balance=(loanSum-fetch_agreed_amount);

UPDATE jaces_fieldmark SET debt_amount=balance;
UPDATE jaces_fieldmark SET position="Ă–denmedi";
if not_found_credit=1 THEN
LEAVE get_list;
END if;
END LOOP get_list;
close siparis;
END;
END;

---------------

Options: ReplyQuote


Subject
Views
Written By
Posted
1959
February 05, 2014 03:56PM
1013
February 05, 2014 04:24PM
895
February 05, 2014 04:30PM
970
February 05, 2014 05:34PM
882
February 05, 2014 05:39PM
1067
February 06, 2014 11:35PM
1022
February 07, 2014 03:27AM
Re: Thread_overrun error
1065
February 07, 2014 03:29AM
986
February 07, 2014 10:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.