Oracle: changing a global temporary table to a normal table and vice versa

alter-tableoracletemporary-tables

Our code make use of a global temporary table which the option 'ON COMMIT DELETE ROWS'. Works well and does the job as expected. But when running my automated tests, i would like the rows to persist, during the session and why not, after the session ended.

Is it possible to alter the table to become a normal table before my test starts and revert it back to a temporary table after the test?

My test suite could drop and recreate the table, but that requires my test suite to know the DDL of the table. I want to avoid this. My testing code only needs to fetch one column. If with time, columns are added, options are changed, my testing code will endure the changes if it can only alter the nature of the table.

Best Answer

No, you cannot change from GTT to a normal table. But, you could create another table to copy your sessions specific data to in order to preserve the information.

More on GTT's