我正在使用以下查询以查看输出但我收到以下错误消息。请你帮帮我吧。
SELECT REGEXP_SUBSTR(pr.Asset, '(.+):.+@',1,1,'i',1) as pr.instancename ,
upper(REGEXP_SUBSTR(pr.Asset, '.+@(.+)s-',1,1,'i',1)) as pr.Servername,
Asset,asset_type,check_category,check_desc,custom_attributes,check_id,db_attributes,occurances,organization,result_status,risk
FROM table1 pr
left join table2 ser on pr.Servername = ser.server_component_name
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 1 Column: 59
有人可以帮助我。
此致
Bharath Vikas
答案 0 :(得分:0)
有些事情是错的。
示例:强>
SELECT *
FROM (
select
REGEXP_SUBSTR(Asset, '(.+):.+@',1,1,'i',1) as InstanceName,
upper(REGEXP_SUBSTR(Asset, '.+@(.+)s-',1,1,'i',1)) as ServerName,
Asset, asset_type, check_category, check_desc,custom_attributes,
check_id, db_attributes, occurances, organization, result_status,
risk
from table1
) pr
left join table2 ser on (pr.ServerName = ser.server_component_name);
免责声明:仅在记事本中进行测试
一些简化的例子:
-- BAD : an alias using an alias
select UPPER(f.bar) as f.UberBar
from Foo f
-- BAD : Foo doesn't have an UberBar column
select UPPER(bar) as UberBar
from Foo
where UberBar = 'BAR'
-- OK : wrapped in a subquery and using the alias in the outer query
select * from (
select UPPER(bar) as UberBar
from Foo
) as Q
where Q.UberBar = 'BAR'
-- OK : repeat the calculation of the value in the ON of the JOIN, or the WHERE clause
select UPPER(bar) as UberBar
from Foo
where UPPER(bar) = 'BAR'