title: Create Temp Table and execute queries on it with Android Room
body: <p>I'm using android room for my database: I'm looking for a way to execute a sequence of actions as in the subsequent code:</p>
  
  <pre><code>@Query( "CREATE TEMP TABLE IF NOT EXISTS t1 (idx INTEGER, rnd_pos INTEGER)")
  fun shuffle_subquery1()
  
  @Query("DELETE FROM t1;")
  fun shuffle_subquery2()
  
  @Query("INSERT INTO t1 SELECT song_id, RANDOM() FROM song_table WHERE playlist_id=:playlistID")
  fun shuffle_subquery3(playlist_id: Int)
  
  @Query("WITH " +
              "i_rnd(idx, rnd_pos) as (SELECT r1.idx, (SELECT COUNT(*) FROM t1 as r2 WHERE r2.rnd_pos&lt;r1.rnd_pos OR " +
              "           (r2.rnd_pos=r1.rnd_pos and r2.idx&lt;r1.idx)) as rnd_pos FROM t1 as r1) " +
              "UPDATE song_table SET rnd_pos=(SELECT rnd_pos FROM i_rnd WHERE song_table.song_id=i_rnd.idx) WHERE playlist_id=:playlistID"
  )
  fun shuffle_subquery4(playlist_id: Int)
  
  @Transaction
  fun shuffle(playlist_id: Int) {
      shuffle_subquery1()
      shuffle_subquery2()
      shuffle_subquery3(playlist_id)
      shuffle_subquery4(playlist_id)
  }
  </code></pre>
  
  <p>This gives error <code>error: UNKNOWN query type is not supported yet. You can use:DELETE, INSERT, SELECT, UPDATE
      public abstract void shuffle_subquery1()</code></p>
  
  <p>and 
  <code>There is a problem with the query: [SQLITE_ERROR] SQL error or missing database (no such table: t1)
      public abstract void shuffle_subquery2()</code></p>
  
  <pre><code>@Transaction
  @Query(
      "CREATE TEMP TABLE IF NOT EXISTS t1 (idx INTEGER, rnd_pos INTEGER);\n" +
              "DELETE FROM t1;\n" +
              "\n" +
              "INSERT INTO t1 SELECT song_id, RANDOM() FROM song_table WHERE playlist_id=:playlistID;\n" +
              "\n" +
              "WITH\n" +
              "i_rnd(idx, rnd_pos) as (SELECT r1.idx, (SELECT COUNT(*) FROM t1 as r2 WHERE r2.rnd_pos&lt;r1.rnd_pos OR \n" +
              "           (r2.rnd_pos=r1.rnd_pos and r2.idx&lt;r1.idx)) as rnd_pos FROM t1 as r1)\n" +
              "UPDATE song_table SET rnd_pos=(SELECT rnd_pos FROM i_rnd WHERE song_table.song_id=i_rnd.idx) WHERE playlist_id=:playlistID;"
  )
  fun shuffle(playlist_id: Int)
  </code></pre>
  
  <p>This version gives error: <code>error: Must have exactly 1 query in the value of @Query or @DatabaseView
      public abstract void shuffle(int playlist_id);</code></p>
  
  <p>Which is the best (and working) way of doing that using Android Room?</p>