title: Inline table in Oracle SQL
body: <p>I'm trying to integrate with some software (that I can't modify) that queries a database that I can modify.</p>
  
  <p>I can give this software SQL queries, like so "select username, firstname, lastname from users where username in ?"</p>
  
  <p>The software than fills in the ? with something like ('alice', 'bob'), and gets user information for them.</p>
  
  <p>Thing is, there's another piece of software, which I again can't modify, which occasionally generates users like 'user2343290' and feeds them through to the first piece of software. Of course, it throws errors because it can't find that user.</p>
  
  <p>So the query I want to run is something like this:</p>
  
  <pre><code>select username, firstname, lastname from users where username in ?
  UNION ALL
  select t.column1, 'Unknown', 'Unknown' from create_table(?) t
  </code></pre>
  
  <p>where create_table generates a table with the rows mentioned in ?, with the first column named column1.</p>
  
  <p>Or alternatively:</p>
  
  <pre><code>select username, firstname, lastname from users where username in ?
  UNION ALL
  select t.column1, 'Unknown', 'Unknown' from _universe_ t where t.column1 in ?
  </code></pre>
  
  <p>where <code>_universe_</code> is some fake table that contains possible every value in column1 (i.e. infinitely large).</p>
  
  <p>I've tried select ? from dual, but unfortunately this only worked when ? was something like ('x'), not ('x', 'y').</p>
  
  <p>Keep in mind I can't change the format of how the ? comes out, so I can't do <code>select 'alice' from dual union all select 'bob' from dual</code>.</p>
  
  <p>Anyone know how I could do what I've mentioned, or something else to have a similar effect?</p>