Quick Search:
 
 Oracle PL/SQL: Temp table demo Jump to:  
Category: >> Oracle PL/SQL >> Temp table demo  

<< lastnext >>

Snippet Name: Temp table demo

Description: Simple demo of Oracle temporary tables.

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 03rd, 2009

DROP TABLE x
/
 
CREATE global temporary TABLE x (a DATE)
        ON COMMIT DELETE rows     -- Delete rows after commit
        -- on commit preserve rows   -- Delete rows after exit session
/
 
SELECT table_name, temporary, duration
FROM   user_tables
WHERE  table_name = 'X'
/
 
INSERT INTO x VALUES (SYSDATE);
 
SELECT * FROM x;
 
COMMIT;
 
-- Inserted rows are missing after commit
SELECT * FROM x;
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org