title: Using SELECT inside COALESCE
body: <p>How do I correct the following SQL code, specifically the COALESCE part?    </p>
  
  <pre><code>insert into Stmt G (ID,blah,foo)
  select
  coalesce(SELECT ID FROM Stmt G WHERE G.CLAIMNO=C.CLNUMBER, select StmtSeq.nextval from dual),
  c.blah,
  d.foo
  from claim c
  left join d on ...;
  </code></pre>
  
  <p>I'm taking the ID from the Stmt table itself if the ClaimNo matches, otherwise creating a new one. Is this not allowed in SQL? How else can I write this statement?</p>
  
  <p>I'm getting a "Missing Expression" error on the coalesce part right now.</p>