title: sql Oracle : Insert a value from another table only when value exists
body: <p>I would like to insert in a table1 a value that comes from another table2 only when value returned from table2 is not null</p>
  
  <p>I would look like to Something like this</p>
  
  <pre><code>  INSERT INTO TABLE1
                  ( IMG_CODE, NAME, AMOUNT) 
                  VALUES ((SELECT MAX(IM_CODE)  FROM IMAGE  WHERE imf_file_name = 'dfkdf4564654.jpg'), 'Meal', 154 )
                  WHERE  ((SELECT MAX(IMF_CODE) FROM IMAGE  WHERE imf_file_name = 'dfkdf4564654.jpg') IS NOT NULL);
  </code></pre>
  
  <p>This request raise an error ORA-00933 - "SQL command not properly ended"</p>
  
  <p>Do you know how to do this?</p>
  
  <p>/</p>