SQL Cursors Questions

1

Constant variable in SQL cursor
select  gthamcode as hamcode, gtnumber as item, ‘G’ from testlib/gtinl01 where (gtnumber between 08000000000000 and 08999999999999) union all select modkey as hamcode, modndcnum as item, ‘M’ from testlib/hammodel where (modndcnum between 08000000000 and 08999999999)   This works with interactive SQL but I need to use this in an COBOL embbeded SQL cursor. The ’M’ and  ’G’ are constants [...]

Answer Question   |  February 28, 2013  7:23 PM
AS/400, SQL Cursors
asked by:
5 pts.

Can two separate cursors update the same SQL table when executed together?
I have three tables. Table One is a master table which contains rows which need to be updated with data from the other two tables (I’ll call them Table Two and Table Three). I have created a cursor which updates existing rows in Table One with data from Table Two. This works fine, and following [...]

Answer Question   |  March 23, 2011  10:57 AM
SQL Cursors, SQL Server 2005, SQL Server 2005 administration, SQL tables
asked by:
5 pts.

SQLRPGLE Cursors and Recursion
I’m trying to recursively call a PI in my SQLRPGLE program. Problem is, I get an SQLCODE error of -519 and I’m sure it has to do with cursors and the prepare statement in my PI. Here’s the code: pprintPrograms    b      dprintPrograms    PI      d program                       10a   value      d spacer                        10a   value      [...]

Answer Question   |  April 12, 2012  11:09 PM
iSeries, Recursion, SQL Cursors, SQLRPGLE
asked by:
465 pts.

SQLRPGLE – Prepare – Declare Cursor
I’m using Prepare, Declare SQL cursor in my SQLRPGLE program After Declare statement I receive SQL -312 – Which indicates to me that the SQL statement is not declared correctly. Is it something wrong with my query. I ran this query in SQL editor and went fine. I dun understand why not in the program. Given [...]

Answer Question   |  August 26, 2009  1:49 AM
SQL Cursors, SQLRPGLE
asked by:
895 pts.

SQL cursor question
hi, i’ve SQLRPGLe program in which i’m writing a cursor to select all records, order them by a field A (suppose employee number). And once all the rows fetched for an employee and printed, print the count at the bottom. Repeat this for all the subsequent employees…. i’m not sure how to handle the print count part…i.e. in SQL how [...]

Answer Question   |  August 20, 2009  2:24 PM
RPGLE, SQL, SQL Cursors
asked by:
895 pts.

Alternatives to cursors in SQL Server
What are the alternatives to cursors? I can’t find any other method to move through record sets one at a time.

Answer Question   |  April 6, 2010  5:49 PM
Cursor, SQL Cursors, SQL Server, SQL Server Cursors
2,585 pts.

what is the max length for an sql cursor name?
what is the max length for an embeded sql cursor name in RPG?

Answer Question   |  March 20, 2009  1:19 PM
Cursor Length, Embedded SQL, RPG, SQL Cursors
asked by:
5 pts.

SQL Cursor to use or not to use
Hi, I’ve been told to never use cursor in SQL, because of possibility of memory leak, etc. But I have no idea of how to implement my script without them. My script doesn’t execute anything on the database, it simply use cursor to create another TSQL script that does the execution. EG. open cursor to [...]

Answer Question   |  January 7, 2009  1:39 PM
SQL, SQL Cursors, SQL scripts, T-SQL
asked by:
290 pts.

1