View previous topic :: View next topic
|
Author |
Message |
Anil Khanna
New User
Joined: 06 Sep 2013 Posts: 15 Location: Cube
|
|
|
|
Am trying to bind a package in IBM DB2 (mainframe) involving a SENSITIVE STATIC SCROLL cursor with ORDER BY and FOR UPDATE clause in it , but it fails with SQLCODE -243 whereas the same bind sucessfull without the ORDER BY clause. Any idea what could be the reason for this? We are using DB2 v10.0.
Output of the BIND is
Code: |
DSNX200I -T1G2 BIND SQL ERROR
USING AIDABPTU AUTHORITY
PLAN=(NOT APPLICABLE)
DBRM=DBAMAGIX
STATEMENT=4586
SQLCODE=-243
SQLSTATE=36001
TOKENS=
CSECT NAME=DSNXEPP
RDS CODE=-190
SQL Statement causing this issue:
EXEC SQL
DECLARE CAGIX723 SENSITIVE STATIC SCROLL CURSOR FOR
SELECT PART_ID
,COLUMN1
,COLUMN2
,COLUMN3
,.
,.
,.
,COLUMNn
WHERE column1 = :host-var1
and column2 = ;host-var2
ORDER BY COLUMN2, COLUMN3 ,COLUMN4
FOR UPDATE
END-EXEC. |
|
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
You cant use FOR UPDATE and ORDER BY simultaneously.
When you mention ORDER BY clause resultant table of query is a read only table and you can not use FOR UPDATE clause for that table
Regards,
Chandan |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Below is the link for similar topic discussed on forum
http://ibmmainframes.com/about45670.html
Also below what DB2 manual says for V10
Quote: |
The ORDER BY clause cannot be used in an outermost fullselect that contains a FOR UPDATE clause |
I also have same doubt as per link why you need order by for performing updates? |
|
Back to top |
|
|
|