View previous topic :: View next topic
|
Author |
Message |
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Hi ,
I have to update a column of table 1 for selected records.
Actually its a sort of inner join on table1 and table2. and we have to update colm1 of table1.
Queries used:
1.
Update Table1 A
Set A.Colm1 = 'X'
Where exists
( Select 1 from Table2 B
where B.colm2 = A.colm2 and
A.com1 = 'Y'
)
2.
Update Table1 A
Set A.Colm1 = 'X'
Where A.colm1 = 'Y' and
A.colm2 in
( Select distinct C.colm2
from Table2 B , Table1 C
where B.Colm2 = C.colm2 and
C.colm1 = 'Y'
)
When I ran both above queries in SPUFI, I received -911.
The 1st query is a corellated sub query, so may be its hitting the deadlock state.
In case of 2nd query I am a bit confused. The inner sub query has no relation with outer one.
Do u have any other ideas to resolve this issue.
Thanks,
-Kapil. |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
I tried to search for this query on google.
I found few links but none seems to be working. It looks like SQL server, MS-Access do have some support for these type of queries.
I am sure there must be something in DB2 also.
Could any one please help ?
Thanks,
-Kapil. |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Hello guys,
Some good news is here.
The problem is fixed. I used the the first query.
1.
Update Table1 A
Set A.Colm1 = 'X'
Where exists
( Select 1 from Table2 B
where B.colm2 = A.colm2 and
A.com1 = 'Y'
)
This was giving -911 while running via SPUFI. This may be because of Timeout.
When I ran the same query in Batch SPUFI.
It worked absolutely fine.
Thanks,
-Kapil. |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Kapil...Thanks for letting us know the solution... |
|
Back to top |
|
|
|