Oracle选择具有特殊名称的列

时间:2011-10-24 10:28:23

标签: database oracle view

我有一个包含名为“Started At”的列的视图。如何在SELECT语句中选择它?

谢谢!

2 个答案:

答案 0 :(得分:5)

尝试

SELECT "Started At"
FROM your_table

答案 1 :(得分:2)

您可以通过将名称括在双引号内来中断Oracle数据库架构对象名称规则(没有保留字,以A-Z开头,长度为30个char等)。要稍后访问该对象,您必须用双引号括起名称。

重点:

me@XE> create table t ("x" int);

Table created.

me@XE> select x from t;

select x from t
       *
ERROR at line 1:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_X'


me@XE> select "x" from t;

no rows selected

me@XE> create view v as select * from t;

View created.

me@XE> select x from v;

select x from v
       *
ERROR at line 1:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_X'


me@XE> select "x" from v;

no rows selected

me@XE>