Temporary tables are useful in applications where a result set is to be bufferd(temporarily persisted), perhaps because it is constructed by running multiple DML operations.For example, consider the following.
临时表在应用程序中是有用的,其中结果集是缓冲的(临时保持),可能是因为它是通过运行多个DML操作构建的。例如,考虑下面的内容。
A Web-based airlines reservations applocation allows a customer to create several optional itineraries.Each itinerary is represented by a row in a temporary table.The application updates the rows to reflect changes in the itineraries.When the customer decides which itinerary she wants to use,the application moves the row for that itinerary to a persistent table.
基于Web的航空公司预订应用程序定位允许客户创建多个可选行程。每个行程由临时表中的一行表示。应用程序更新这些行以反映行程中的更改。当客户决定要使用哪个行程时,应用程序将该行程的行移动到持久表中。
During the session,the itinerary data is private.At the end of the session,the optional itineraries are dropped.
在会话期间,行程数据是私有的。会话结束时,可选的行程将被删除。
The definition of a temporary table is visible to all sessions,but the data in a temporary table is visible only to the session that inserts the data into the table.
临时表的定义对所有会话可见,但临时表中的数据仅对将数据插入表中的会话可见。
Unlike permanent tables,temporary tables and their indexes do not automatically allocate a segment when they are created.Instead,segments are allocated when the first INSERT(or CREATE TABLE AS SELECT)is performed.Therefore,if a SELECT,UPDATE,or DELETE is performed before the first INSERT,then the table appears to be empty.
与永久表不同,临时表及其索引在创建时不会自动分配段。相反,段是在执行第一次插入(或CREATE TABLE AS SELECT)时分配的。因此,如果在第一次插入之前执行SELECT、UPDATE或DELETE,则表呈现为空。
DDL operations(except TRUNCATE)are allowed on an existing temporary table only if no session is currently bound to that temporary table.
仅当当前没有会话绑定到现有临时表时,才允许对该临时表执行DDL操作(TRUNCATE除外)。
If you rollback a transaction,the data you entered is lost,although the table definition persists.
如果回滚事务,则输入的数据丢失,尽管表定义仍然存在。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




