Anorm says no results were returned for select query preceded by inserts (PSQLException: No results were returned by the query) <p>I'm writing a Play 2 application with a Postgres backend.</p> <p>My code has a sql string which is a concatenation of two inserts and a select. Then when I try to execute my query, anorm blows up and says me no results have been returned. I could break it up into two separate queries but then I'd be making an unnecessary trip to the database?</p> <p>The sql string is pretty simple.</p> <pre><code>val sql = """ insert into gameconstants ... values ...; insert into gamevariables ... values ...; select lastval() as gameid; """ </code></pre> <p>Then the code that throws the exception just tries to get the gameid from query. This should work right?</p> <pre><code>DB.withTransaction { implicit connection =&gt; val gameid = SQL(sql).on( ... )() .map(row =&gt; row[Long]("gameid")).head } </code></pre> <p>Here is the error <strong>[PSQLException: No results were returned by the query.]</strong></p>