delete from
(select * from (select rownum nn,t.* from table_1 t) z
where z.nn between 1 and 100)括号内的 分页查询 可以查出来数据1-100条,但是删除的时候出现
ORA-01752:不能从一个没有键值保存表的视图中删除请问这个是什么意思啊?如何解决这个表没有主键也没有和其它表关联,我也设置过主键,依旧如此解决就给分,请高手指点小菜!

解决方案 »

  1.   

    delete from
    (select * from (select rownum nn,t.* from table_1 t) z
    where z.nn between 1 and 100) vv where vv.* is not null;
    试试
      

  2.   

    ORA-01747:无效的用户.表.列,或者列规格试了,出现如上错误。怎么办呀?
      

  3.   

    lz 想删除什么?虚拟表z吗?怎么可能删除呢?
    建议改为:
    delete from table_1 a
    where exists
    (
    select * from (select rowid rid,rownum nn,t.* from table_1 t) z
    where z.nn between 1 and 100 and a.rowid=z.rowid
    )
      

  4.   

    回复wiler:我试了,还是提示错误。
    ORA-01446:无法从含DISTINCT,GROUP BY等执教的视图中选择ROWID请问是不是不能这样排序删除呢?我用得是PL/SQL 7
      

  5.   

    应该是:
    delete from table_1 a
    where exists
    (
    select * from (select rowid rid,rownum nn,t.* from table_1 t) z
    where z.nn between 1 and 100 and a.rowid=z.rid
    )
      

  6.   

    谢谢wiler,可以删除!但是速度慢,比直接清空表里1万条数据还慢很多。
    可能是涉及到rowid吧。
    同时也谢谢tgm78。
    给分结帖