日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle视图view看不出来主键,oracle - 使用主键创建视图

發布時間:2023/12/19 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle视图view看不出来主键,oracle - 使用主键创建视图 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

簡單的答案是你的語法不正確。您必須指定DISABLE。

NOVALIDATE禁用主鍵驗證,在視圖中這是默認值,因此自動包含;但是如果你使用它會更清楚,因為在一個可愛的雙重否定中,disable novalidate禁用了禁用主鍵的功能。

rely是可選的;它指定在創建視圖時是否考慮主鍵。 rely的反義詞是norely。

創建視圖約束有很多限制,因為它依賴于下表,它并不像@RC已經注意到的那樣值得。但如果您只需要文檔,那么請轉到:

SQL> create table tmp_test ( a number(10), b varchar2(120) );

Table created.

SQL>

SQL> insert into tmp_test

2 select level, 'b'

3 from dual

4 connect by level <= 20

5 ;

20 rows created.

SQL> commit ;

Commit complete.

SQL>

SQL> alter table tmp_test

2 add constraint tmp_test_pk

3 primary key (a)

4 using index;

Table altered.

SQL>

SQL> create or replace view v_tmp_test (a, b

2 , constraint v_tmp_test_pk primary key (a) rely disable novalidate) as

3 select a, b

4 from tmp_test

5 ;

View created.

SQL>來自documentation:

View Constraints

Oracle does not enforce view constraints. However, operations on views

are subject to the integrity constraints defined on the underlying

base tables. This means that you can enforce constraints on views

through constraints on base tables.

Notes on View Constraints View constraints are a subset of table

constraints and are subject to the following restrictions:

You can specify only unique, primary key, and foreign key constraints

on views. However, you can define the view using the WITH CHECK OPTION

clause, which is equivalent to specifying a check constraint for the

view.

View constraints are supported only in DISABLE NOVALIDATE mode. You

cannot specify any other mode. You must specify the keyword DISABLE

when you declare the view constraint. You need not specify NOVALIDATE

explicitly, as it is the default.

The RELY and NORELY parameters are optional. View constraints, because

they are unenforced, are usually specified with the RELY parameter to

make them more useful. The RELY or NORELY keyword must precede the

DISABLE keyword. Please refer to "RELY Clause" for more information.

Because view constraints are not enforced directly, you cannot specify

INITIALLY DEFERRED or DEFERRABLE.

You cannot specify the using_index_clause, the exceptions_clause

clause, or the ON DELETE clause of the references_clause.

You cannot define view constraints on attributes of an object column.

總結

以上是生活随笔為你收集整理的oracle视图view看不出来主键,oracle - 使用主键创建视图的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。