Deadlock of an update with its own subquery?



I had a strange deadlock recently. I may be wrong, but it looks like
an update query deadlocked with its own subquery???

My question is such a thing possible? If so, how do you avoid it?

The host is a Solaris 8 box with ASE 12.5.0.3

The error log message is:

04:00000:00411:2007/02/13 16:22:20.23 server Error: 1608, Severity:
18, State: 4
04:00000:00411:2007/02/13 16:22:20.24 server A client process exited
abnormally, or a network error was encountered. Unless other errors
occurred, continue processing normally.
02:00000:00415:2007/02/13 16:47:42.76 server Deadlock Id 2 detected
Deadlock Id 2: detected. 1 deadlock chain(s) involved.

Deadlock Id 2: Process (Familyid 156 156) (suid 105) was executing a
UPDATE command in the procedure 'cs_imp_fund_update'.
SQL Text:
Deadlock Id 2: Process (Familyid 415, 415) (suid 105) was executing a
UPDATE command at line 1.
SQL Text: UPDATE cs_fund SET compliance_tolerance = 0 WHERE
acct_typ_cd = 'G' AND EXISTS (SELECT 1 FROM cs_fund f, cs_fund_config
fp WHERE fp.parent_acct_cd = cs_fund.acct_cd AND f.syst_of_reference =
'EAGLE_US_IDX' AND fp.child_acct_cd = f.acct_cd)
Deadlock Id 2: Process (Familyid 0, Spid 415) was waiting for a
'update row' lock on row 4 page 215652 of the 'CS_FUND' table in
database 5 but process (Familyid 156, Spid 156) already held a 'update
row' lock on it.
Deadlock Id 2: Process (Familyid 0, Spid 156) was waiting for a
'update row' lock on row 4 page 214025 of the 'CS_FUND' table in
database 5 but process (Familyid 415, Spid 415) already held a 'update
row' lock on it.

Deadlock Id 2: Process (Familyid 0, 156) was chosen as the victim. End
of deadlock information.

.