473,385 Members | 1,901 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,385 software developers and data experts.

trouble with open cursor in DB2

5
Hello

Sorry, I don't find a specific forum for DB2, please help me with this. The cursor don't open :-(, I don't know why, any ideas?

I want to update the colum "co_peticion" from table rem_tempo2 with the respective value from the table peti_imp.

The procedure is:

CREATE PROCEDURE act_copeticion (OUT errorCode INTEGER, OUT errorLabel CHAR(32)
)
RESULT SETS 0
LANGUAGE SQL
BEGIN
DECLARE SQLCODE INTEGER DEFAULT 0;
DECLARE acopeticion VARCHAR(50);
DECLARE acaseid VARCHAR(50);
DECLARE bcopetremedy VARCHAR(50);

DECLARE c1 CURSOR FOR
SELECT case_id, co_peticion
FROM rem_tempo2
order by case_id
FOR UPDATE OF co_peticion;

DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND
SET errorCode = SQLCODE;

OPEN c1;
SET errorLabel = 'OPEN CURSOR';
WHILE ( SQLCODE != 100 )
DO
FETCH c1 INTO acaseid, acopeticion;
select codigopeticionremedy into bcopetremedy from peti_imp where case_id = acaseid;
update rem_tempo2 set co_peticion = bcopetremedy where CURRENT OF c1;
END WHILE ;

SET errorLabel = 'CLOSE CURSOR';
CLOSE c1;
END


The result is:
Value of output parameters
--------------------------
Parameter Name : ERRORCODE
Parameter Value : 100

Parameter Name : ERRORLABEL
Parameter Value : OPEN CURSOR

Return Status = 0


more information: the table rem_tempo2 have an index on case_id
Oct 18 '06 #1
1 3377
jmaria
5
Sorry, thanks, I could execute it ok
Oct 19 '06 #2

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

Similar topics

1
by: Bernard Drolet | last post by:
Hi, I have a recursive table "Objectnew" with the columns "objectref" (primary key), objectname, objectid, and parentobjectid Recursive Relation: objectid ----< Parentobjectid I have the...
2
by: Richard | last post by:
Hi all, I had a stored procedure that i wanted to be able to pass parameters to so i used dynamic SQL. I am getting very strange errors though when i try to execute it. My code works just fine,...
2
by: Tom Alcendor | last post by:
I am building a chess game application that allows a user to click on a piece and move it to a new square. When the user clicks on a piece the mouse pointer must change to the image associated...
12
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the...
59
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when...
5
by: Nicolay A. Vasiliev | last post by:
Hello there! I got some trouble trying to insert data into the database with MySQLdb module. I have such code: from MySQLdb import * def loc_connect_db():
3
by: Morten Snedker | last post by:
If I have a number of random applications open, move the mouse cursor to a given position and do a click, the application gets the focus. That is what this simple code should illustrate: Dim...
1
by: runningsnake24 | last post by:
We are writing a program to check that a filled in Sudoku puzzle is solved correctly. We are required to use the Iterator and Iterable interfaces. The program uses a Cell class to represent each...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.