I would like to know which is the command to convert a temporary table to permanent table in Oracle.
Other issue is about the index. An index used in a temporary table will be the same used in a permanent table, if I convert it?
A temporary table can be altered in the same way as a permanent base table although there is no official support to toggle the behavior of the ON COMMIT clause. The specification offers an ALTER TABLE syntax to toggle that behavior.
Permanent tables have a Fail-safe period similar to transient tables and provide additional security of data recovery and protection. Presently, the permanent table cannot be modified to Transient Table using ALTER TABLE command.
A permanent table ( materialized table) is stored as a file in hard disks. The temporary table just lives in a transaction. In addition, a global temp table could be alive outside transaction, but not really stored.
You can't convert a table from a temporary table to a permanent table.
You can create a new permanent table that matches the structure of the temporary table
CREATE TABLE new_permanent_table
AS
SELECT *
FROM old_temporary_table
WHERE 1=0;
Or you could get the DDL for the temporary table using the DBMS_METADATA
package and manually edit the DDL to create the new permanent table.
Then you can create whatever indexes you would like on the new permanent table and drop the old temporary table. Once the old temporary table is dropped, you can rename the permanent table to use the name of the old temporary table if you would like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With