【问题标题】:PL/SQL: ORA-00907: missing right parenthesisPL/SQL: ORA-00907: 缺少右括号
【发布时间】:2013-12-19 07:47:21
【问题描述】:

我有这个代码的错误

ORA-00907:缺少右括号

select buyer
,cobuyer
, case
            when Sp_Desc like('ma%') then 'mail'
            when Sp_Desc like('pa%') then 'phone'      
            else " "
            end AS Special_Handling 
            from
              ( string_function(g.buyer_id)
                from gift g ) AS Sp_Desc  
, salary
, etc

【问题讨论】:

  • 不清楚您认为buyercobuyersalary 等列的来源。您不能使用 AS 作为表别名。此外," " 无效 - 可能应该是 ' '
  • 买家和共同买家只是选择语句,我补充说,该案例处于几个选择语句的中间。我试图完成的是 1: Generate Sp_Desc in this statement: string_function(g.buyer_id) AS Sp_Desc 并在 case 语句中使用它来在这个语句中创建 Special_Handling 列: , case when Sp_Desc like('ma%')然后 'mail' 当 Sp_Desc like('pa%') 然后 'phone' else ' ' end AS Special_Handling 希望你能帮助我。

标签: oracle


【解决方案1】:
select 
  buyer 
  , cobuyer 
  , case when Sp_Desc like('ma%') then 'mail' 
         when Sp_Desc like('pa%') then 'phone'
    else ' '
    end 
  AS Special_Handling 
from 
  ( SELECT string_function(g.buyer_id) from gift g ) Sp_Desc

【讨论】:

    猜你喜欢
    • 2016-02-20
    • 2016-10-23
    • 2018-05-23
    • 2017-03-11
    • 1970-01-01
    • 2018-05-23
    • 2018-12-06
    相关资源
    最近更新 更多