delete from(
select 1
  from cust_interest a, cust_basicinfo b
 where a.cust_no = b.cust_no
  and b.cust_status <> '0');
这个语句是删除cust_interest表中的数据,我就是不知道oracle怎么确定删除cust_interest表而不是cust_basicinfo表数据,
请大家指导一下,谢谢。

解决方案 »

  1.   

    呵呵,不但是你不知道,连ORACLE也不太清楚吧。
    这个语句执行的时候会报错。SQL Error: ORA-01752: cannot delete from view without exactly one key-preserved table
    01752. 00000 -  "cannot delete from view without exactly one key-preserved table"
    *Cause:    The deleted table either had no key perserved tables,
               had more than one key-preserved table, or the key-preserved
               table was an unmerged view or a table from a read-only view.
    *Action:   Redefine the view or delete it from the underlying base tables.
      

  2.   

    当然能成功了,不然我为什么法帖求助! 这种用法肯定是可以用的。
    alter table CUST_INTEREST
      add constraint PK_CUST_INTEREST primary key (TX_DATE, CUST_NO, TYPE, END_DATE);
    alter table CUST_BASICINFO
      add constraint PK_CUST_BASICINFO primary key (CUST_NO);