Re: Thread_overrun error
Posted by:
Rick James
Date: February 07, 2014 10:34AM
> UPDATE jaces_fieldmark SET debt_amount=balance;
Is jaces_fieldmark a temporary table whose sole purpose is to hold debt_amount?
If so, use a variable instead: @debt_amount.
I still don't see what you are trying to accomplish. Please study this to see if it is related:
SELECT
@balance := @balance + amount AS running_sum,
FROM ( SELECT @balance := 0 )
JOIN MyTbl
WHERE ...
ORDER BY ...
It calculates a "running sum" of the column `amount`.
It does it _without_ a cursor.
The subquery is to initialize @balance without having to issue a second SELECT or SET. (This is a minor issue.)
Rule of Thumb: Cursors can usually be turned into single statements. Always try to do so. The code will run much faster; the code will (ultimately) be simpler.
Subject
Views
Written By
Posted
2461
February 05, 2014 03:56PM
1253
February 05, 2014 04:24PM
1075
February 05, 2014 04:30PM
1149
February 05, 2014 05:34PM
1085
February 05, 2014 05:39PM
1330
February 06, 2014 11:35PM
1227
February 07, 2014 03:27AM
1270
February 07, 2014 03:29AM
Re: Thread_overrun error
1226
February 07, 2014 10:34AM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
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.