Custom Search . . .

Friday, July 13, 2007

Table

Global Temporary Tables

They are temporary tables is the sense of the data that is stored in the table, not in definition of the table itself. The command Create Global temporary table created temp tables. all users who have permissions on the table itself can perform DML on a temporary table.

There are two different flavors of temp data in a temp table.

1. Temporary for the duration of the transaction.

2. Temporary for the duration of the session.

On commit delete rows - Removes all rows from the temp. tale when a commit or rollback issued.

On commit preserve rows - Keeps the rows in the table beyond the tran. boundary. However the users session terminated all of the user row's in the temp. table removed.

Example:

SQL> create global temporary table babu ( eno int) on commit delete rows;

Table created.

SQL> insert into babu values (10);

1 row created.

SQL> insert into babu values (20);

1 row created.

SQL> insert into babu values (30);

1 row created.

SQL> select * from babu;

ENO
----------
10
20
30

SQL> commit;

Commit complete.

SQL> select * from babu;

no rows selected



No comments: