[20171218]字段命名与oracle关键字.txt

[20171218]字段命名与oracle关键字.txt

--//再次提醒开发应该在数据库字段命令上避开oracle关键字(保留字).避免出现混乱.

SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SCOTT@book> create table t2 ( user varchar2(20));
create table t2 ( user varchar2(20))
                  *
ERROR at line 1:
ORA-00904: : invalid identifier
--//user是保留字.

SCOTT@book> create table t2 ( "USER" varchar2(20));
Table created.

SCOTT@book> insert into t2 values ('aaaa');
1 row created.

SCOTT@book> commit ;
Commit complete.

SCOTT@book> select user from t2;
USER
------
SCOTT
--//返回当前用户名.

SCOTT@book> select user,"USER" from t2;
USER   USER
------ -----
SCOTT  aaaa

SCOTT@book> select * from v$reserved_words where KEYWORD='USER' ;
KEYWORD                            LENGTH R R R R D
------------------------------ ---------- - - - - -
USER                                    4 N N N Y N

--//参考链接:http://blog.itpub.net/267265/viewspace-2142685/

上一篇:[20171225]没有备份数据文件的恢复.txt


下一篇:[20171218]修改AWR snapshot 设置.txt