1. Transaction-specific
create global temporary table tblTempTest
(
Column1 VARCHAR2(50),
Column2 VARCHAR2(50),
Column3 VARCHAR2(50)
) ON COMMIT DELETE ROWS;
INSERT INTO tblTempTest VALUES ('Row1', 'Row1', 'Row1');
INSERT INTO tblTempTest VALUES ('Row2', 'Row2', 'Row2');
INSERT INTO tblTempTest VALUES ('Row3', 'Row3', 'Row3');
SELECT COUNT(*) FROM tblTempTest;
-- RESULT: 3
COMMIT;
SELECT COUNT(*) FROM tblTempTest;
-- RESULT: 0
2. Session-specific
create global temporary table tblTempTest
(
Column1 VARCHAR2(50),
Column2 VARCHAR2(50),
Column3 VARCHAR2(50)
) ON COMMIT PRESERVE ROWS;
INSERT INTO tblTempTest VALUES ('Row1', 'Row1', 'Row1');
INSERT INTO tblTempTest VALUES ('Row2', 'Row2', 'Row2');
INSERT INTO tblTempTest VALUES ('Row3', 'Row3', 'Row3');
SELECT COUNT(*) FROM tblTempTest;
-- RESULT: 3
COMMIT;
SELECT COUNT(*) FROM tblTempTest;
-- RESULT: 3
No comments:
Post a Comment