oracle 12c 视图中的不可见列
invisible columns in oracle 12c view
Oracle 1Z0-047 sql 专家考试的主题之一是 "Create simple and complex views with visible/invisible columns"。我可以创建具有不可见列的表,我可以创建包含那些不可见列的视图,但我找不到使这些列在结果视图中不可见的语法。 Oracle 文档在数据库 SQL 语言参考 "Create View"
页面中提到了 visible/invisible,但没有给出具体示例,我尝试遵循他们的波浪图失败了:
create or replace view jl_book_author as
select title, b.isbn isbn invisible, lname, fname
from jl_books b
join jl_bookauthor a on b.isbn = a.isbn
join jl_author r on a.authorid = r.authorid
order by title, lname, fname;
ERROR at line 3:
ORA-00923: FROM keyword not found where expected
知道如何使视图的列不可见吗?为什么我要这样做而不是为了通过考试?
这行得通。指定 "INVISIBLE"
的唯一方法是在视图中使用列别名。别名、约束和 INVISIBLE/VISIBLE
修饰符需要放在视图名称和关键字 "AS" 之间的括号中。
create or replace view jl_book_author (tl, bn INVISIBLE, al, af) as
select title, b.isbn, lname, fname
from jl_books b
join jl_bookauthor a on b.isbn = a.isbn
join jl_author r on a.authorid = r.authorid
order by title, lname, fname;
"why I would want to do this other than to pass the exam?"
您使用 INVISIBLE
子句,如 Oracle SQL 参考 CREATE TABLE
中所述,将列添加到任何 table,而没有包含通配符 SELECT *
语句随意添加。
因此,对于向 table 添加您不希望 legacy 代码随意操作的列非常有用。
有关更完整的解释和示例,请参阅 MAY/JUNE 2014 版 Oracle 杂志中的文章 ASK TOM: technology。
Oracle 1Z0-047 sql 专家考试的主题之一是 "Create simple and complex views with visible/invisible columns"。我可以创建具有不可见列的表,我可以创建包含那些不可见列的视图,但我找不到使这些列在结果视图中不可见的语法。 Oracle 文档在数据库 SQL 语言参考 "Create View"
页面中提到了 visible/invisible,但没有给出具体示例,我尝试遵循他们的波浪图失败了:
create or replace view jl_book_author as
select title, b.isbn isbn invisible, lname, fname
from jl_books b
join jl_bookauthor a on b.isbn = a.isbn
join jl_author r on a.authorid = r.authorid
order by title, lname, fname;
ERROR at line 3:
ORA-00923: FROM keyword not found where expected
知道如何使视图的列不可见吗?为什么我要这样做而不是为了通过考试?
这行得通。指定 "INVISIBLE"
的唯一方法是在视图中使用列别名。别名、约束和 INVISIBLE/VISIBLE
修饰符需要放在视图名称和关键字 "AS" 之间的括号中。
create or replace view jl_book_author (tl, bn INVISIBLE, al, af) as
select title, b.isbn, lname, fname
from jl_books b
join jl_bookauthor a on b.isbn = a.isbn
join jl_author r on a.authorid = r.authorid
order by title, lname, fname;
"why I would want to do this other than to pass the exam?"
您使用 INVISIBLE
子句,如 Oracle SQL 参考 CREATE TABLE
中所述,将列添加到任何 table,而没有包含通配符 SELECT *
语句随意添加。
因此,对于向 table 添加您不希望 legacy 代码随意操作的列非常有用。
有关更完整的解释和示例,请参阅 MAY/JUNE 2014 版 Oracle 杂志中的文章 ASK TOM: technology。