从合并视图中选择不起作用的组合视图吗? [英] Select out of a combined view with concatenation not working?
问题描述
我尝试使用+
在一个列中创建具有两个值的视图,并且该视图已成功创建,但是当我尝试从中选择所有视图时,会出现以下错误:
I tried creating a view with two values in one column using +
, and the view was created successfully, but when I try selecting all from it it gives me this error:
select *
*
ERROR at line 1:
ORA-01722: invalid number
我尝试研究此运算符和串联运算符,但令我沮丧的是没有找到任何帮助.这是我用来创建视图的代码,也用于选择.
I tried researching this and the concatenation operator but to my dismay have found no help. Here is the code I used to create the view, and the select also.
CREATE VIEW CombinedNameEmployeePhoneView AS
SELECT (EMPLOYEE.LastName + ' ' + EMPLOYEE.FirstName)
AS EmployeeName, EMPLOYEE.Phone as EmployeePhone
from EMPLOYEE;
select *
from CombinedNameEmployeePhoneView;
推荐答案
The concatenation operator in Oracle is the double pipe, ||
. The +
is used for adding numbers together, hence the error.
该视图已成功创建,因为Oracle在创建数据时不会评估数据;只是确保它可以编译.
The view was created successfully because Oracle doesn't evaluate the data when creating it; merely ensures that it compiles.
这篇关于从合并视图中选择不起作用的组合视图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!