If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > multirow

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-07, 15:08
lullo lullo is offline
Registered User
 
Join Date: Nov 2003
Posts: 20
Red face multirow

Hi, I have created a query to update my table. I take the values to update it puting in join trhee tables. this join return to me 4 rows and the column to update are 4. It's possible to update my column with multi value (4 in this case)?

this is my query...

UPDATE DBFN01.CLIENT_BD_TOTAL AS TC
SET TC.PERCCOERNOTCOER =
(
SELECT (PERCENTAGE-T.PERCTOTASSETCLASS) PERCCOERNOTCOER
FROM DBFN01.CLIENT_BD_TOTAL T
LEFT OUTER JOIN(
SELECT * FROM DBFN01.CLIENT_BD_TOTAL T ,
DBFN01.RPFPFMMULBANKID RPF,
DBFN01.PFMASSCLASSBDENTRY P
WHERE RPF.PROFILEID=T.RISKPROFILEID AND RULEID=1
AND RPF.PTFID=P.PTFID AND T.ASSETCLASSID=P.ID) TEST
ON (T.EXTERNALID=TEST.EXTERNALID)
WHERE T.ACLEVEL =2 AND T.EXTERNALID = '001994275_REF'
)

WHERE ACLEVEL =2 AND EXTERNALID = '001994275_REF'

thk
Reply With Quote
  #2 (permalink)  
Old 01-22-07, 23:43
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
No,
ur join shld return 1 value
Reply With Quote
  #3 (permalink)  
Old 01-23-07, 07:46
vini_srcna vini_srcna is offline
Registered User
 
Join Date: May 2006
Posts: 82
As rahul told you cannot do that. By the way what do you mean by
"It's possible to update my column with multi value (4 in this case)?"

If the select query in the SET clause results more than one value DB2 would through you some negative error code. It should fetch one and only one value. You cannot use FETCH FIRST 1 ROW ONLY also. The conditions in the WHERE predicate should be qualified for one row only.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On