zoukankan      html  css  js  c++  java
  • ORA-14450

    ORA-14450 attempt to access a transactional temp table already in use

    Cause: An attempt was made to access a transactional temporary table that has been already populated by a concurrent transaction of the same session.

    Action: Do not attempt to access the temporary table until the concurrent transaction has committed or aborted.

    一般情况下,ORA-14450在自治事务中出现的多一些,大家在使用自治事务时一定要小心

    SQL> create global temporary table temp_toms
    2 (
    3 str varchar2(64)
    4 ) on commit delete rows;

    表已创建.

    SQL>

    SQL> select * from temp_toms;

    未选定行

    SQL> insert into temp_toms values('1234');

    已创建 1 行。

    SQL> select * from temp_toms;

    STR
    --------------------------------
    1234

    SQL> 
    SQL> declare
    2 pragma autonomous_transaction;
    3 begin
    4 insert into temp_toms values('other transaction use temp_toms test');
    5 commit;
    6 end;
    7 /
    declare
    *
    第 1 行出现错误:
    ORA-14450: 试图访问已经在使用的事务处理临时表
    ORA-06512: 在 line 4


    SQL> select * from temp_toms;

    STR
    --------------------------------
    1234

    SQL>

    另外一种情况下,也能出现ORA-14450的错误,测试如下

    SQL> select sid from v$mystat where rownum=1;

    SID
    ----------
    104
    SQL>

    SQL> desc temp_toms
    名称 是否为空? 类型
    ----------------------------------------- -------- -----------------
    STR VARCHAR2(32)

    SQL> insert into temp_toms values('modify structur test');

    已创建 1 行。

    SQL> 
    SQL> select * from temp_toms;

    STR
    --------------------------------
    modify structur test

    SQL>


    此时,在SID=104的session中不做commit/rollback,打开另外一个session,尝试修改临时表结构,
    看看会出现什么现象:

    C:Documents and Settingsunix>sqlplus study/study

    SQL*Plus: Release 10.2.0.1.0 - Production on 星期六 5月 6 12:26:54 2006

    Copyright (c) 1982, 2005, Oracle. All rights reserved.


    连接到:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options

    SQL> select sid from v$mystat where rownum=1;

    SID
    ----------
    90

    SQL>
    SQL> alter table temp_toms add name varchar2(32);
    alter table temp_toms add name varchar2(32)
    *
    第 1 行出现错误:
    ORA-14450: 试图访问已经在使用的事务处理临时表

  • 相关阅读:
    【BZOJ-3712】Fiolki LCA + 倍增 (idea题)
    【BZOJ-1941】Hide and Seek KD-Tree
    【BZOJ-2400】Spoj839Optimal Marks 最小割 + DFS
    【BZOJ-3709】Bohater 贪心
    【BZOJ-2342】双倍回文 Manacher + 并查集
    【BZOJ-3790】神奇项链 Manacher + 树状数组(奇葩) + DP
    【BZOJ-4568】幸运数字 树链剖分 + 线性基合并
    【BZOJ-4520】K远点对 KD-Tree + 堆
    【BZOJ-4127】Abs 树链剖分 + 线段树 (有趣的姿势)
    【BZOJ-2648&2716】SJY摆棋子&天使玩偶 KD Tree
  • 原文地址:https://www.cnblogs.com/HansonYao/p/4310252.html
Copyright © 2011-2022 走看看