注意,要创建view或materialized view等用到select 查询需要用到别名时尽量不要加上" ",否则要以后从这个view查询时比较容易出错。
例如建了这样一个view:
QL> create view test as select code "style",grp from prd where code like 'S0000%';
View created
SQL> select * from test;
style GRP
------------------------------ ------------------------------
S000001A 2
S000002A 2
S000003A 2
S000004A 2
S000005A 3
S000006A 3
S000007A 3
S000008A 3
S000009A 3
S000010A 3
S000011A 3
S000012A 3
S000013A 3
但是这样写就不行
SQL> select style. from test;
select style. from test
ORA-00904: "STYLE": invalid identifier
必须要:
SQL> select "style" from test;
style
------------------------------
S000001A
S000002A
S000003A
S000004A
S000005A
S000006A
S000007A
S000008A
S000009A
还有在开发form的时候要用到这个view,那么style这个列会识别不出来,所以尽量不要用带" "的别名。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13387766/viewspace-425590/ ,如需转载,请注明出处,否则将追究法律责任。