語法:
create view viewname[(columnname1,columnname2,....)]
as
subquery
[with check option constraint constraintname]
[with read only]
例如:
create view testview as select * from test where deptno=10 with check option constraint ck_deptno;
在視圖上只能插入deptno為10的數據行,並且只能在視圖上修改除deptno之外的其他列的值(update時).
當使用read only選項時,只能在視圖上執行查詢操作.
註釋:
如果視圖包含group by字句,分組函數和distinct關鍵字,則不能在該視圖上執行任何DML操作.
Update操作原則:不能更新基於函數或表達式所定義的列,不能更新偽列(ROWID和ROWNUM等)
insert操作原則:如果視圖不包含表的Not NULL列,則不能通過視圖增加數據.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25198367/viewspace-704241/,如需转载,请注明出处,否则将追究法律责任。