title: PostgreSQL table variable
body: <p>Is there anything like table variables in T-SQL?<br>
  In Sql Server it looks like this:</p>
  
  <pre><code>DECLARE @ProductTotals TABLE
  (
    ProductID int,
    Revenue money
  )
  </code></pre>
  
  <p>Then in procedure I can:</p>
  
  <pre><code>INSERT INTO @ProductTotals (ProductID, Revenue)
    SELECT ProductID, SUM(UnitPrice * Quantity)
    FROM [Order Details]
    GROUP BY ProductID
  </code></pre>
  
  <p>And manipulate with this variable like an ordinary table.</p>
  
  <p>Here is description: <a href="http://odetocode.com/Articles/365.aspx" rel="noreferrer">http://odetocode.com/Articles/365.aspx</a></p>