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.

  • I'm wondering if you could do something funky with a 2nd table & synonyms. – Philᵀᴹ Apr 11 '17 at 15:04

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.