[英]SQL Temporary Table Issue
I've created a temporary table DETAILS
and follow the same syntax of creating and inserting in it.我创建了一个临时表
DETAILS
并遵循在其中创建和插入的相同语法。 But I have not received any result set However, the CREATE
and INSERT
statements ran successfully and the Row was also affected in the INSERT statement.但是我没有收到任何结果集但是,
CREATE
和INSERT
语句运行成功,并且 Row 在 INSERT 语句中也受到了影响。 But the result set was empty when I ran the last SELECT
statement to view the record.但是当我运行最后一条
SELECT
语句查看记录时,结果集为空。
DROP TABLE DETAILS ;
CREATE GLOBAL TEMPORARY TABLE DETAILS AS (
SELECT ins_id , firstname , pages FROM
INSTRUCTOR)DEFINITION ONLY;
INSERT INTO DETAILS
SELECT ins_id , firstname , pages
FROM INSTRUCTOR WHERE ins_id = '1';
SELECT * FROM DETAILS ;
If you want to preserve rows in CGTT after commit, you have to specify ON COMMIT PRESERVE ROWS
option of the CREATE GLOBAL TEMPORARY TABLE statement.如果要在提交后保留 CGTT 中的行,则必须指定CREATE GLOBAL TEMPORARY TABLE语句的
ON COMMIT PRESERVE ROWS
选项。
ON COMMIT DELETE ROWS
option is in effect otherwise, and such a table is cleared on commit. ON COMMIT DELETE ROWS
选项在其他情况下生效,并且这样的表在提交时被清除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.