CASE语句出错

时间:2013-01-16 15:06:50

标签: oracle10g oracle11g

编写CASE语句时出现问题。请帮助

insert into CDR(rts,smscid,count,statusflag,operator,identifier)
     select trunc(rts),smscid,statusflag,operator, 
     (case when smscid='BPL-MUM' and operator='BPL' and  is_number(replace(replace(replace(senderid, 'DM-',''), 'LM-',''),'BT-',''))=0 THEN "LOOP TRANSACTIONAL"
          when smscid='BPL-MUM' and operator!='BPL' and  is_number(replace(replace(replace(senderid, 'DM-',''), 'LM-',''),'BT-',''))=0 THEN "NONLOOP TRANSACTIONAL"
          When Smscid='BPL-MUM' And Operator='BPL' And  Is_Number(Replace(Replace(Replace(Senderid, 'DM-',''), 'LM-',''),'BT-',''))!=0 THEN "LOOP PROMOTIONAL"
          when smscid='BPL-MUM' and operator!='BPL' and  is_number(replace(replace(replace(senderid, 'DM-',''), 'LM-',''),'BT-',''))!=0 THEN  "NONLOOP PROMOTIONAL" 
          END),sum(count)    
      From Mis_Summary_Dn  Where Rts Between '26-dec-2012' And '27-dec-2012' And Statusflag='SUCCESS' Group By Trunc(Rts),Smscid,Statusflag,Operator; 

我正在犯错误

SQL Error: ORA-00904: "NONLOOP PROMOTIONAL": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:

1 个答案:

答案 0 :(得分:2)

将您的字符串放在单引号中,而不是双引号。双引号用于标识符

'NONLOOP PROMOTIONAL'