oracle ora01732,一天一小步_2008.5.02: ora-01732错误
前兩天老大在從一個表中刪除數據的時候碰到了01732錯誤,可一查文檔才知道01732是對視圖的操作不合法才能碰到的,這是官方的定義:
ORA-01732 data manipulation operation not legal on this
view
Cause: An attempt was made to use an UPDATE, INSERT, or
DELETE
statement on a view that contains expressions or functions or was
derived from
more than one table. If a join operation was used to create the
view or the view
contains virtual columns derived from functions or expressions,
then the view
may only be queried.
Action: UPDATE, INSERT, or DELETE rows in the base tables instead
and
restrict the operations on the view to queries.
可是我們當時從dba_objects中查哪個對象確實顯示是個表,老大也說那是個表,到底怎么回事呢?后來google了,也沒有搜出個所以然來,這里有兩篇文章好像都提到了這個問題可是也沒有最終的解決方法,
這里又搜到的一篇文章,可能有用,把他貼出來:
ORA-01732:?Data manipulation operation not
legal on this view
You are trying to update or
delete a materialized view, but the materialized view was created
with the default option of read only.
The truncate command however works perfect.
You'll have to specify the for update clause when you create
a materialized view.
eg:
SQL> desc t
Name?Null??Type
----------------------------------------- -------- -------
C?NUMBER
create materialized view v
REFRESH FORCE WITH ROWID
DISABLE QUERY REWRITE AS
(
select * from t
)
/
SQL> delete from v;
delete from v
*
ERROR at line 1:
ORA-01732: data manipulation operation not legal on this view
SQL> truncate table v;
Table truncated.
SQL> drop materialized view v;
Materialized view dropped.
SQL> create materialized view v
2?REFRESH FORCE WITH
ROWID
3?for update
4?DISABLE QUERY REWRITE
AS
5?(
6?select * from t
7?);
Materialized view created.
SQL> delete from v;
2 rows deleted.
雖然這個問題還沒有解決,我也沒有什么好的辦法,但綜合搜索的結果,我有以下幾個處理的思路:
1.首先5月4號去了之后搞清楚出問題哪個表的類型,到底是一個表、視圖還是物化視圖?也即搞清楚這個對象的詳細定義,oracle
9i
之后提供了DBMS_METADATA包,明天就來研究一下這個包的使用。
2.參考這個:
Ian,
You are correct. If you're connected as FARS_OWNER the public
synonym will not be referenced since you own a table named
MFGALIASTYPE.
I suspect the error is not being signaled by the insert itself,
but by some underlying recursive sql. Is there a trigger on this
table? If not, the trace file generated by the following events
should help (you may need to log a tar with support for assistance
in reading the trace file).
alter session set events '10046 trace name context forever,
level 4';
alter session set events 1732 trace name errorstack forever, level
10';
和itpub上某位版主的建議,我覺得應該用10046事件來追蹤一下,對10046還不是很熟悉,后天再研究一下10046.
大概想到就這兩點,現在沒有環境,就做些準備工作,5.4去了再好好研究研究這個。
總結
以上是生活随笔為你收集整理的oracle ora01732,一天一小步_2008.5.02: ora-01732错误的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 小米5x内存不够用?教你两招清理内存,手
- 下一篇: 用php求n个分数的和,php关于数组n
