473,473 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DB2 cursor problems

1 New Member
Hi :

I had these procedure and when i try to execute it, it's only execute 100000 rows, any ideas.

CREATE PROCEDURE SATT.MIGRA_INTCTA_2005 ( )
SPECIFIC SATT.SQL060523130507007
LANGUAGE SQL
NOT DETERMINISTIC
CALLED ON NULL INPUT
EXTERNAL ACTION
OLD SAVEPOINT LEVEL
MODIFIES SQL DATA
INHERIT SPECIAL REGISTERS
BEGIN
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE V_NO_DATA INT DEFAULT 0;
DECLARE VARSMLCUOTA SMALLINT;
DECLARE VARSMLTRICOD SMALLINT;
DECLARE VARINTPRECOD INTEGER;
DECLARE VARINTADMCOD INTEGER;
DECLARE VARSMLANO SMALLINT;
DECLARE VARINTCTANUM INTEGER;
DECLARE VARINTCTAAFE INTEGER;
DECLARE VARNUMREC DECIMAL (5,0);
DECLARE not_found CONDITION FOR '02000';
DECLARE CURGCUCTA CURSOR WITH RETURN FOR
SELECT INTCTANUMERO, SMLCTACUOTA,SMLTRICODIGO, INTPRECODIGO, INTADMCODIGO, SMLANOANIOPRO
FROM GCUCTACTE
WHERE SMLTRICODIGO in (1,2,5,6) AND SMLANOANIOPRO = 2005;
DECLARE CONTINUE HANDLER FOR NOT FOUND
-- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND
SET V_NO_DATA = 1;
-- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
-- SET VARCTLCUR = NULL;
SET VARNUMREC = 0;
OPEN CURGCUCTA;
FETCH CURGCUCTA INTO VARINTCTANUM, VARSMLCUOTA, VARSMLTRICOD, VARINTPRECOD, VARINTADMCOD, VARSMLANO;
WHILE (V_NO_DATA = 0 ) DO
IF VARSMLTRICOD = 1 THEN
SET VARINTCTAAFE = (SELECT INTBIPCORREL
FROM DJUBASEIMPONIBLEPREDIAL
WHERE INTADMCODIGO = VARINTADMCOD
AND SMLANOANIOPRO = VARSMLANO
AND VCHBIPESTADO = '1');
ELSE
SET VARINTCTAAFE = (SELECT intdarcorrel
FROM gcudeterminacionarbitrios
WHERE vchdarestado = '1'
AND smlctacuota = VARSMLCUOTA
AND smltricodigo = VARSMLTRICOD
AND smlanoaniopro = VARSMLANO
AND intadmcodigo = VARINTADMCOD
AND INTPRECODIGO = VARINTPRECOD);

END IF;
INSERT INTO TMP_MIGRA (INTCTANUMERO) VALUES (VARINTCTANUM);
IF (SQLCODE !=0 ) THEN
INSERT INTO TMP_MIGRA (INTCTANUMERO)
VALUES (VARINTCTANUM);
RETURN;
END IF;
IF (VARINTCTAAFE is not null) OR (VARINTCTAAFE != 0) THEN
UPDATE GCUCTACTE SET INTCTAAFECTA = VARINTCTAAFE WHERE INTCTANUMERO = VARINTCTANUM;
END IF;
SET VARNUMREC = VARNUMREC + 1;
FETCH CURGCUCTA INTO VARINTCTANUM, VARSMLCUOTA, VARSMLTRICOD, VARINTPRECOD, VARINTADMCOD, VARSMLANO;
END WHILE;
CLOSE CURGCUCTA;
commit;
END;
May 23 '06 #1
0 6652

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

Similar topics

6
by: Matthew Houseman | last post by:
All, I've created a synonym that points to a package over a database link like so: CREATE SYNONYM API_MYLINK FOR USER.CSAPI_V2@INSTANCE.DOMAIN.COM I've granted execute like so: grant execute...
1
by: Yaron Cohen | last post by:
Hi, I would like to ask for your help (I am using only IE5.5). I have a very big table that I would like to sort. During the sort I would like the cursor changed to 'wait' state and back to...
10
by: Bill H | last post by:
I used a bit of JS on a page that is fairly long and didn't like the way that <A HREF='#' ONCLICK=\"... refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...) solved my...
3
by: Andy G | last post by:
This should be very simple but I can't figure it out or find ANYTHING posted about how to change your cursor to an hourglass. I have a ASP.NET web form using VB.NET code behind. When I click on a...
8
by: Eddie | last post by:
Hi All, I just want to change the mouse cursor during a process. I want a hourglass... How may I do it ? Thx
1
by: Søren Larsen | last post by:
In a stored procedure (SP1) I am looping through a cursor with records from Table1. Each record in the cursor is inserted into Table2. Insert trigger on Table2 is inserting the record into Table3...
2
by: Jim Frazer | last post by:
Hi, I'm working on an application in C# that will allow the user to create simple CAD drawings on a CEPC system. I would like to be able to change the cursor shape depending on the drawing mode...
7
by: P. Adhia | last post by:
Sorry for quoting an old post and probably I am reading out of context so my concern is unfounded. But I would appreciate if I can get someone or Serge to confirm. Also unlike the question asked in...
5
by: szymon.strus | last post by:
Hello I have a VB6 application using classic ado (MDAC 2.8) for connecting ms sql 2000 server. Application uses a lot of server side cursors. Now I want to switch to ms sql 2005 server but I...
0
by: Pierre | last post by:
Hello, I'm having problems to use the get method on a cursor with an index (secondary database). I've read Oracle's docs but there are mainly in C, JAVA and C++. So no python docs! actually,...
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.