Update - blanks existing values for columns [message #265777] |
Fri, 07 September 2007 06:24 |
raj75
Messages: 11 Registered: August 2007
|
Junior Member |
|
|
UPDATE METRO_FDC.E_L_PROC a
SET (a.EQU_IP, a.TRAV_IP, a.INSERT_DT)= (
SELECT b.EQU_IP, b.TRAV_IP, b.INSERT_DT
FROM TEMP_L_PROC b
WHERE a.LOTO = b.LOTO and
a.STEP = b.STEP);
After executing the above code, I queried metro_fdc.e_l_proc and the value seems to be blank for the 3 columns while previously it existed.
select * from metro_fdc.e_l_proc;
LOTO STEP EQU_IP TRAV_IP INSERT_DT
-------------------- -------------------- --------- ---------- ---------
6089857.006 4000-41 CONTACT BPSG DEP
6089857.001 4000-41 CONTACT BPSG DEP AAAAAAA100 U48BJ72500 07-SEP-07
6089857.002 4000-41 CONTACT BPSG DEP BPPR7A6100 U48BK72500 07-SEP-07
6089857.003 4000-41 CONTACT BPSG DEP CCCCCC5200 U48BJ72500 07-SEP-07
6089857.004 4000-41 CONTACT BPSG DEP BPPR7A6100 U48BK72500 07-SEP-07
6089857.005 4000-41 CONTACT BPSG DEP BPPR7A6200 U48BD11111 07-SEP-07
|
|
|
|
|
|
|
Re: Update - blanks existing values for columns [message #268068 is a reply to message #265777] |
Mon, 17 September 2007 07:45 |
MarcL
Messages: 455 Registered: November 2006 Location: Connecticut, USA
|
Senior Member |
|
|
To try and explain further:
The select within your update statement is choosing which values to use to update the appropriate columns.
The where clause outside the inline select is choosing which rows in the table should be updated. Without this specification all the rows in the table will be updated, hence your null values.
[Updated on: Mon, 17 September 2007 07:45] Report message to a moderator
|
|
|
|