create global temporary table abcd as select a.a1,b.b2 from a,b where a.id=b.id 这个语句执行后表中没内容。
create global temporary table abcd as select a.a1,b.b2 from a,b where a.id=b.id on commit delete rows;这个语句在Oracle 10g中执行时会出现“命令未正确结束”的错误,希望高手指点。如果正确,我会多加15分,因为我就这么多了。
是在sql*plus中
temporary table :临时表,有两种方法1、on commit delete rows;当COMMIT的时候删除数据2、on commit preserve rows;当COMMIT的时候保留数据当不写的时候默认为1。所以你的第一条语名自然没有数据。但你如果在程序中使用的话此临时表的数据的生命周期就是本程序开始至结束。第二条语句要变为:create global temporary table abcd on commit delete rows as select a.a1,b.b2 from a,b where a.id=b.id ;
比如临时表叫temp,你要查询的语句为select * from 表名 where id=1。如果temp表存在:insert into temp select * from 表名 where id=1;commit;如果temp表不存在create table temp as insert into temp select * from 表名 whe
临时table在commit后都看不到数据吧。create动作又是那种默认commit的。所以, 在后面的insert 动作后,应该是可以看到。create global temporary table abcdon commit delete rows as select a.a1,b.b2 from a,b where a.id=b.