--测试
create table a
(
a1 int,
a2 int
)create table b
(
b1 int,
b2 int
)insert into a select 1,11
insert into a select 2,12insert into b select 1,31
insert into b select 3,32--这样写竟然没有错误提示!!!
select * from a
where a1 not in (select a1 from b)--这样写竟然没有错误提示!!!select * from #a
where a1 = (select top 1 a1 from #b)为什么呢?

解决方案 »

  1.   

    insert into a select 1,11
    改成 insert into a select 1,11 from dualselect * from #a
    where a1 = (select top 1 a1 from #b)
    改成 
    select * from #a
    where a1 = (select a1 from #b where rownum = 1)
      

  2.   

    ztoracle中临时表1) ON COMMIT DELETE ROWS 定义了建立事务级临时表的方法.
    CREATE GLOBAL TEMPORARY TABLE admin_work_area
            (startdate DATE,
             enddate DATE,
             class CHAR(20))
          ON COMMIT DELETE ROWS;2)ON COMMIT PRESERVE ROWS 定义了创建会话级临时表的方法.
    CREATE GLOBAL TEMPORARY TABLE admin_work_area
            (startdate DATE,
             enddate DATE,
             class CHAR(20))
         ON COMMIT PRESERVE ROWS;