View previous topic :: View next topic
|
Author |
Message |
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
Hi ,
im using the rowset positioning of a cursor to get the rows from my table butthe rows returned are 'NONE'
below is my fetch cursor
Code: |
01 ws-ar-data.
05 ws-ar-a1 pic x(02) occurs 15 times.
05 ws-ar-a2 pic x(02) occurs 15 times.
DECLARE A1_CUR CURSOR WITH
ROWSET POSITIONING FOR
SELECT
A1,A2
INTO :A1,:A2
FROM A1_TABLE
WHERE
AX_1 = :AX-1
|
im then openening my curor ande fetching it.
Code: |
EXEC SQL
OPEN A1_CUR
END-EXEC.
EXEC SQL
FETCH NEXT ROWSET FROM A1_CUR FOR 15 ROWS
INTO :WS-AR-A1
,:WS-AR-A2
END-EXEC.
EXEC SQL
GET DIAGNOSTICS :WS-COUNT = ROW_COUNT
END-EXEC.
|
it is returning me a sqlcode +100 while there are 15 rows in that table and also the WS-COUNT is holding zeroes in it.
Please help me ,where i have made any mistakes if any present in this code. |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi Tecnokrat,
Put
After every EXEC SQL ... END-EXEC. statement and checkout the sqlcodes. Also check SQLERRD(3) infomation.
Let us know what happens ?
Sushanth |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
he knows what happens : sqlcode = +100 and row-count = 0
check out definition and content of :ax-1. |
|
Back to top |
|
|
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
AX-1 is defined as pic s9(09).
and the where condition holds good as all the 15 rows are present in the table ... |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Tecnokrat,
In my example mult-row fetch program, i have declared cursor in the following format.
Code: |
EXEC SQL
DECLARE A1_CUR CURSOR WITH ROWSET POSITIONING
FOR
SELECT A1,A2
FROM A1_TABLE
WHERE AX_1 = :AX-1
END-EXEC. |
Check it out.
Sushanth |
|
Back to top |
|
|
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
i have also given the same thing but i dint metioned here in the example in myt post |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Tecnokrat,
Check your package QUALIFIER, whether its pointing to the right database.
Sushanth |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
Put a display and make sure AX-1 has desired value before opening the cursor. |
|
Back to top |
|
|
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
resolved my problem as one of the key field was not included in the WHERE clause.
sorry for the trouble. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
tecnokrat,
thanks for getting back; and kudos for one of the few honest solutions. |
|
Back to top |
|
|
|