Delete row using Cursor having multiple rows



IBM's flagship relational database management system

Delete row using Cursor having multiple rows

Postby nikesh_rai » Sat Mar 15, 2014 7:22 pm

Hi,

I have declared a Cursor as below:

DECLARE WS-A-SR CURSOR WITH HOLD FOR
       SELECT A.COLUMN_1, A.COLUMN_2, A.COLUMN_3,B.COLUMN_1,B.COLUMN_2
       FROM (SELECT COLUMN_1,COLUMN_2,COLUMN_3 FROM TABLEXX) AS A
       INNER JOIN (SELECT COLUMN_1, COLUMN_2 FROM TABLEZZ) AS B
        ON A.COLUMN_1 = B.COLUMN_1
          AND A.COLUMN_3 = B.COLUMN_3
       WHERE A.COLUMN_5 = Some Value
          AND A.COLUMN_6 = Some Value
       FOR UPDATE


Now, I have to use delete cursor to delete rows from table a XX, I used the below statement in the same program:

DELETE FROM TABLEXX
WHERE CURRENT OF WS-A-SR


However I am getting error code -510 at bind time. Please suggest me if something is wrong here
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Delete row using Cursor having multiple rows

Postby nikesh_rai » Sat Mar 15, 2014 7:23 pm

Sorry, the title should be

Delete row using Cursor having multiple tables
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post