【发布时间】:2021-03-10 07:24:07
【问题描述】:
我正在尝试在 sql developer、Oracle 12c 中运行查询。
Select id, phone_number, null as contact,null as name from emp;
我现在需要添加 2 个带有空数据的额外列。
上面的查询抛出错误:from keyword not found where expected.
我在这里做错了什么?
【问题讨论】:
我正在尝试在 sql developer、Oracle 12c 中运行查询。
Select id, phone_number, null as contact,null as name from emp;
我现在需要添加 2 个带有空数据的额外列。
上面的查询抛出错误:from keyword not found where expected.
我在这里做错了什么?
【问题讨论】:
是的,因为列名不能是 number - 它是为 datatype 保留的。
将列重命名为其他名称。
正如您评论的那样,列名 - 实际上是 - phone_number。如果是这样,查询工作正常:
SQL> select * from emp;
ID PHONE_NUMB
---------- ----------
1 1234-5678
SQL> select id, phone_number, null as contact, null as name from emp;
ID PHONE_NUMB C N
---------- ---------- - -
1 1234-5678
SQL>
【讨论】: