Oracle的列名能不能用下划线开头,例如: _Identify, _Locked, _SortKey 本人没有条件测试,还请大家帮我的是一下上述三个名称能否用在Oracle中。谢谢了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把列名用双引号括起来SQL> create table t3("_Identify" number,"_Locked" number,"_SortKey" number);Table created.SQL> insert into t3 values(1,1,1);1 row created.SQL> commit;Commit complete.SQL> select * from t3; _Identify _Locked _SortKey---------- ---------- ---------- 1 1 1 中间有下划线没有关系吧?例如:fx_identify, fx_locked, fx_sortkey 直接不行,不过可以加双引号SQL> edit已写入 file afiedt.buf 1 create table test (_Identify varchar2(1), 2 _Locked varchar2(1), 3* _SortKey varchar2(1))SQL> /create table test (_Identify varchar2(1), *第 1 行出现错误:ORA-00911: 无效字符SQL> edit已写入 file afiedt.buf 1 create table test ("_Identify" varchar2(1), 2 "_Locked" varchar2(1), 3* "_SortKey" varchar2(1))SQL> /表已创建。SQL> desc test 名称 是否为空? 类型 ----------------------------------------- -------- -------------------------- _Identify VARCHAR2(1) _Locked VARCHAR2(1) _SortKey VARCHAR2(1)SQL> select "_Identify" from test;------------------------------------------------------------------------------ Blog: http://blog.csdn.net/tianlesoftware 网上资源: http://tianlesoftware.download.csdn.net 相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx Q Q 群:62697716 谢谢wh62592855,你可能帮我解决了一个大问题,因为有很多历史文件(Access和SQL SERVER格式)的列名是用下划线开头,如果要改是非常麻烦的。是不是Oracle中的特殊表名和列名,用双引号括起来即可,例如:Select "_Identify","_Locked", "_SortKey" From "_表A"也就说双引号类似SQL Server中的方括号,我在SQl Server中是这样处理的:Select [_Identify],[_Locked], [_SortKey] From [_表A] 呵呵 不客气你不可能摸透ORACLE的每一条明明规范因此当你在尝试以某个名称来命名表或者列的时候出现了错误你可以尝试使用""来把它们包起来 这样系统就不会特意的去检查或者误以为是关键词表名也是一样的SQL> create table _t4(id number);create table _t4(id number) *ERROR at line 1:ORA-00911: invalid characterSQL> create table "_t4"(id number);Table created. 这个是个bag,这样也可以 createtable "_t3" ("_Identify"number,"_Locked"number,"_SortKey"number);Table created.但是你select *from _t3是不存在该表的 这样可以吧:Select * From [_t3] SQL> select * from "_t4";no rows selected加上引号啊 oracle连接 关过SQL过滤相同字段重复的记录 关于sqlplus命令的问题,在线等,急用~~ Oracle成生xml问题 请问如何搜索整个方案中的所有存储过程的某个字符 oracle定时器(jop) 什么叫存储过程 有没有办法开机之后即让ORACLE数据库实例自动启动——长期病痛 初学者一问,oracle里的表空间有什么用 这段SQL语句错在哪里? 如何修改oracle数据库的名字??急!!! 关于oracle的timestamp with time zone的问题
SQL> create table t3("_Identify" number,"_Locked" number,"_SortKey" number);Table created.SQL> insert into t3 values(1,1,1);1 row created.SQL> commit;Commit complete.SQL> select * from t3; _Identify _Locked _SortKey
---------- ---------- ----------
1 1 1
例如:fx_identify, fx_locked, fx_sortkey
直接不行,不过可以加双引号
SQL> edit
已写入 file afiedt.buf 1 create table test (_Identify varchar2(1),
2 _Locked varchar2(1),
3* _SortKey varchar2(1))
SQL> /
create table test (_Identify varchar2(1),
*
第 1 行出现错误:
ORA-00911: 无效字符
SQL> edit
已写入 file afiedt.buf 1 create table test ("_Identify" varchar2(1),
2 "_Locked" varchar2(1),
3* "_SortKey" varchar2(1))
SQL> /表已创建。
SQL> desc test
名称 是否为空? 类型
----------------------------------------- -------- -------------------------- _Identify VARCHAR2(1)
_Locked VARCHAR2(1)
_SortKey VARCHAR2(1)SQL> select "_Identify" from test;
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
Q Q 群:62697716
因此当你在尝试以某个名称来命名表或者列的时候出现了错误
你可以尝试使用""来把它们包起来 这样系统就不会特意的去检查或者误以为是关键词表名也是一样的
SQL> create table _t4(id number);
create table _t4(id number)
*
ERROR at line 1:
ORA-00911: invalid character
SQL> create table "_t4"(id number);Table created.
这样可以吧:
Select * From [_t3]