首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

请大家分析如下语句,看oracle是如何工作的

2012-03-08 
请大家分析如下语句,看oracle是怎么工作的?delete from(select 1from cust_interest a, cust_basicinfo bw

请大家分析如下语句,看oracle是怎么工作的?
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表数据,
请大家指导一下,谢谢。

[解决办法]
呵呵,不但是你不知道,连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.

[解决办法]

SQL code
[Quote=引用:]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_basicinf……[/Quote]这个语句本身写法,我都觉得没有见过!
[解决办法]
同样表示没有见过,同样求解。。。

探讨
SQL code
[Quote=引用:]
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表中的数据,我就……

[解决办法]
探讨
to 兰兰姐:你执行报这个错应该是你测试脚本中表的主键定义不合这种写法的规范,如果合规,肯定是能执行的。

热点排行
Bad Request.