Hi, I'm an Oracle novice so any help is appreciated. I have 2 tables with fields shown below:
MASTER TEMP
PartNumber PartNumber
MaxStock MaxStock
other fields calculation fields
TEMP contains a subset of parts from MASTER and I want to update the MaxStock in MASTER with the TEMP MaxStock (PartNumber is Primary Key for both and no duplicates). I've tried:
UPDATE MASTER SET MASTER.MAXSTOCK = TEMP.MAXSTOCK FROM TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER (error ORA-00933 SQL command not properly ended)
UPDATE (SELECT DISTINCT MASTER.PARTNUMBER, TEMP.PARTNUMBER, MASTER.MAXSTOCK, TEMP.MAXSTOCK FROM MASTER, TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER) SET MASTER.MAXSTOCK = TEMP.MAXSTOCK (error ORA-00904 invalid column name)
UPDATE MASTER SET MASTER.MAXSTOCK = (SELECT TEMP.MAXSTOCK FROM TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER) (error ORA-01407 cannot update MaxStock field to NULL)
Bit puzzled. Any ideas.
Thanks, Andy
MASTER TEMP
PartNumber PartNumber
MaxStock MaxStock
other fields calculation fields
TEMP contains a subset of parts from MASTER and I want to update the MaxStock in MASTER with the TEMP MaxStock (PartNumber is Primary Key for both and no duplicates). I've tried:
UPDATE MASTER SET MASTER.MAXSTOCK = TEMP.MAXSTOCK FROM TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER (error ORA-00933 SQL command not properly ended)
UPDATE (SELECT DISTINCT MASTER.PARTNUMBER, TEMP.PARTNUMBER, MASTER.MAXSTOCK, TEMP.MAXSTOCK FROM MASTER, TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER) SET MASTER.MAXSTOCK = TEMP.MAXSTOCK (error ORA-00904 invalid column name)
UPDATE MASTER SET MASTER.MAXSTOCK = (SELECT TEMP.MAXSTOCK FROM TEMP WHERE MASTER.PARTNUMBER = TEMP.PARTNUMBER) (error ORA-01407 cannot update MaxStock field to NULL)
Bit puzzled. Any ideas.
Thanks, Andy