title: Updating table while joining across multiple tables
body: <p>I am (fairly new to) using PL/SQL with Oracle 12c, and am having trouble with a procedure I am trying to implement. I've looked up a lot of tutorials and similar questions here, but so far I've had no luck finding anything that could help me. The situation is this:</p>
  <p>I have three tables: table1, table2, and table3.</p>
  <blockquote>
  <p>Table1 has the attributes detailA and detailB.</p>
  <p>Table2 has the attributes detailB and detailC.</p>
  <p>Table3 has the attributes detailC and detailD.</p>
  </blockquote>
  <p>My goal is to update the value of detailA in table1 to be equal to detailD in table2. I'm aware that in order to do that I need to join table1 and table2 on detailB, then join table2 and table3 on detailC. Actually implementing that, though, is giving me trouble.</p>
  <p>So far, everything I've tried goes off-rails about halfway through—I'm having a very hard time implementing all the conditions I need to check while still keeping it within the structure of PL/SQL.</p>
  <p>Here's an (obviously very wrong) example of something I've tried:</p>
  <pre><code>    UPDATE (SELECT table1.detailB, table2.detailB, table2.detailC, 
      table3.detailC, table3.detail4 FROM table1
      JOIN table2 on table1.detailB =  table2.detailB
      JOIN table3 on table2.detailC = table3.detailD)
      SETtable1.detailA = table3.detail4;
  </code></pre>
  <p>If anyone could help me understand this better, I'd be very grateful.</p>
  <p>EDIT: And for an example with some actual data, if I inserted the following, it should replace the 100 in table1 with the 1000 in table4 when I run my query:</p>
  <pre><code>INSERT INTO table1(detailA, detailB) VALUES (100, 200);
  INSERT INTO table2(detailB, detailC) VALUES (200, 400);
  INSERT INTO table3(detailC, detailD) VALUES(400, 1000);
  </code></pre>