Wednesday, November 17, 2010

Oracle - Creating Temporary Tables

A GLOBAL TEMPORARY table has a persistent definition but data is not persistent and the global temporary table generates no redo or rollback information. For example if you are processing a large number of rows, the results of which are not needed when the current session has ended, you should create the table as a temporary table instead:


create global temporary table tempTab
(
    ID NUMBER(2) PRIMARY KEY,
    PRODNAME VARCHAR2(5)
   
)
ON COMMIT DELETE ROWS/ ON COMMIT PRESERVE ROWS

                            OR

create global temporary table tempTab
ON COMMIT PRESERVE ROWS
AS select * from <TABNAME>

No comments:

Post a Comment