title: Empty global temporary table in oracle
body: <p>I'm porting some triggers from SQL server to Oracle. There is a query based on the data that's being deleted, and the sql server operation is something like:</p>
  
  <pre><code>SELECT a, b 
  INTO #my_temp_table 
  FROM
  (
      SELECT A, B, C, D
      FROM DELETED D
      INNER JOIN MYTABLE M ON D.ID = M.ID
  )
  </code></pre>
  
  <p>The real query is very complicated and I don't know what it's really doing, so I am not able to do any edits.</p>
  
  <p>I was looking for a similar structure in Oracle, and I found the GLOBAL TEMPORARY TABLE, so I did something like</p>
  
  <pre><code>CREATE GLOBAL TEMPORARY TABLE my_temp_table 
  ON COMMIT PRESERVE ROWS
  AS
      SELECT A, B, C, D
      FROM MYTABLE
  </code></pre>
  
  <p>which is actually working fine. </p>
  
  <p>My problem is when the query is not returning any data, I get an <code>ORA-01723: zero-length columns are not allowed</code>.
  Is there any way to make it work?</p>