I have a table that keeps track of the physical mass of sprockets in my inventory.
create table sprockets(
    id NUMBER,
    mass NUMBER
);
INSERT into sprockets VALUES (1, 4);
INSERT into sprockets VALUES (2, 8);
INSERT into sprockets VALUES (3, 15);
INSERT into sprockets VALUES (4, 16);
INSERT into sprockets VALUES (5, 23);
INSERT into sprockets VALUES (6, 42);
I employ sprocket mechanics to perform routine maintenance on my sprockets. If their modifications make the sprocket's mass change, they make a note of it in their maintenance report.
create table maintenance_events(
    sprocket_id NUMBER,
    new_mass NUMBER
);
--chipped a widget off of sprocket #1; mass reduced to 3 kg
INSERT into maintenance_events VALUES (1, 3);       
--new lead bearings makes sprocket #2 weigh 413 kg
INSERT into maintenance_events VALUES (2, 413);     
I want to keep the sprockets table updated with the current mass of each sprocket. I want to take the new_mass in maintenance_events and overwrite the old mass values in sprockets. I referred to the top two answers from this question, but both give errors.
UPDATE sprockets
set mass = maintenance_events.new_mass
from sprockets, maintenance_events
where sprockets.id = maintenance_events.sprocket_id
Error at Command Line:2 Column:38
Error report:
SQL Error: ORA-00933: SQL command not properly ended
UPDATE sprockets
set sprockets.mass = maintenance_events.new_mass
from sprockets
INNER JOIN maintenance_events
on sprockets.id = maintenance_events.sprocket_id
Error at Command Line:2 Column:48
Error report:
SQL Error: ORA-00933: SQL command not properly ended
What am I doing wrong?
 
     
     
     
    