字段名或者表名可以以下划线开头,但必须用双引号括起来;
范例:
SQL> create table t1(_col1 number,_col2 number);
create table t1(_col1 number,_col2 number)
ORA-00911: 无效字符
SQL> create table t1("_col1" number,"_col2" number);
Table created
说明:直接创建时提示:ORA-00911: 无效字符错误。如果用双引号括起来则OK没问题。
范例:
SQL> insert into t1(_col1,_col2) values(1,2);
insert into t1(_col1,_col2) values(1,2)
ORA-00911: 无效字符
SQL> insert into t1("_col1","_col2") values(1,2);
1 row inserted
说明:同理再做insert,update,delete操作时,也必须用双引号括起来。
本文介绍了在SQL中如何正确地使用以下划线开头的字段名,并提供了具体的创建表及插入数据的操作示例。
3581

被折叠的 条评论
为什么被折叠?



