ora-01445:無法從不帶保留關鍵字的表的串連視圖中選擇ROWID或採樣,ora-01445rowid

來源:互聯網
上載者:User

ora-01445:無法從不帶保留關鍵字的表的串連視圖中選擇ROWID或採樣,ora-01445rowid

今天在對視圖進行查詢時,查詢中帶有rowid欄位,結果報錯:

 

 

做了兩張簡單的表測試:STUDENT,CLASS

1、建立表

create table STUDENT
(
  sno   NUMBER,
  sname VARCHAR2(32)
)

-----------------------------------

create table CLASS
(
  cno   NUMBER not null,
  sno   NUMBER not null,
  cname VARCHAR2(32)
)

 

2、建立一個視圖

create or replace view stu_class_v as
     select s.sno, s.sname, c.cno, c.cname

     from student s, stu_class c
 where s.sno = c.sno

3、對視圖進行查詢

  select rowid, sno From stu_class_v

 

這時就會報出如上錯誤

 

因為建立的兩張表,主表和從表都沒有設定對應的主鍵,這裡對STUDENT表添加主鍵,再對視圖進行查詢,查詢正常

 

 

 

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.