简体   繁体   English

CASE SQL Oracle查询-有什么问题?

[英]CASE SQL Oracle Query - What is wrong?

I have following query to select the view to be used in the query, however I get the error: 我有以下查询来选择要在查询中使用的视图,但是出现错误:

FROM keyword not found where expected 在预期位置找不到FROM关键字

select *, (CASE WHEN 'employee' = 'employee' THEN employee ELSE vw END) FROM type1

You cannot use * and individual columns together in select statement. 您不能在选择语句中同时使用*和各个列。

SELECT  (CASE WHEN 'employee' = 'employee' THEN 'employee' ELSE 'vw' END)
  FROM  dual
select type1.*,
      (CASE WHEN 'employee' = 'employee'
            THEN employee 
            ELSE vw 
       END)
FROM type1

I always prefix with the tablename/table alias to the * and it works!! 我总是与表名/表别名前缀 *和它的作品!

We just need to specify, fetch all the column from this table, when we specify combination of wildcard and other select expressions! 当指定通配符和其他选择表达式的组合时,我们仅需要指定并从this表中获取all列!

You cant do a *, in Oracle without an alias/TableName(.) in front of it. 在Oracle中,如果前面没有别名/ TableName(。),则无法执行*, List out the columns you want to see in the result set or add a table alias/tablename. 列出您要在结果集中看到的列或添加表别名/表名。

您不能设置选择语句应从语句的列列表部分中检索数据的视图的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM