在oracle中动态的修改全局临时表的表结构

birdsmaller 2005-10-14 10:02:27
在存储过程中用这样一条语句动态修改临时表结构,
select count(1) into vCount from user_tab_columns
where upper(TABLE_NAME) = upper('Temp_Table') and Upper(COLUMN_NAME) = Upper('SH'||vMoveTypeCode || 'Money');
if (vCount <= 0 ) then
Execute immediate ('ALTER TABLE Temp_Table ADD SH'||vMoveTypeCode
|| 'Money decimal(20,8) default 0');
end if;

但是在并发的时候就会提示“ora-14450 试图访问正在使用的事务级临时表”
...全文
294 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
birdsmaller 2005-10-17
  • 打赏
  • 举报
回复
select 子句缺少into语句
sasacat 2005-10-14
  • 打赏
  • 举报
回复
改之前先“select * from Temp_Table for update”这个语句会等待到这个表没人用时锁定这表只让你一个人用。然后你再ALTER TABLE
birdsmaller 2005-10-14
  • 打赏
  • 举报
回复
有没有好的方法解决这个问题呢?^_^
sasacat 2005-10-14
  • 打赏
  • 举报
回复
报什么错啊
birdsmaller 2005-10-14
  • 打赏
  • 举报
回复
好像是不可以的,在存储过程里面都执行不过去:(
birdsmaller 2005-10-14
  • 打赏
  • 举报
回复
然后再commit吗?我试试^_^

17,140

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧