程序失败编译

时间:2018-09-27 10:56:58

标签: oracle plsql

我有一个创建表adwstg.switchhold_notificatn_stg

的现有过程

突然在创建表时抛出错误。我没有改变声明。

首先我以为错误是``No''。因此找到并用'

替换'

但是它在行上抛出错误:

nvl(ba300_z51.sent_650_01, 'No') sent_650_01,
  

错误(27,29):PLS-00103:预期以下情况之一时遇到符号“ NO”:*&=-+; 在in是mod余数,而不是rem <>或!=或〜=> = <= <>和||之间的like2 like4 likec多集成员submultiset ***

下面是查询:

create table adwstg.switchhold_notificatn_stg nologging parallel (degree 8) compress as
select distinct
bad3700.createdon,
bad3700.uc_pod_ext,
bpc.cacont_acc, 
bad3700.notificatn, 
bad3700.nfcat_code, 
nvl(ba300_z51.sent_650_01, ''No'') sent_650_01,
decode(ba300_z51.sent_650_01,''No'',''--'',''Yes'',to_char(ba300_z51.ucswmsgdat,''yyyymmdd''),''--'') date_sent_650_01,
nvl(to_char(ba300_z51.ucswmsgtim,''hh24:mi:ss''),''--'') time_sent_650_01,
nvl(ba300_z52.received_650_02, ''No'') received_650_02,
decode(ba300_z52.received_650_02,''No'',''--'',''Yes'',to_char(ba300_z52.ucswmsgdat,''yyyymmdd''),''--'') date_received_650_02,
nvl(to_char(ba300_z52.ucswmsgtim,''hh24:mi:ss''),''--'') time_received_650_02,
nvl(ba300_z20.received_814_20, ''No'') received_814_20,
decode(ba300_z20.received_814_20,''No'',''--'',''Yes'',to_char(ba300_z20.ucswmsgdat,''yyyymmdd''),''--'') date_received_814_20,
nvl(to_char(ba300_z20.ucswmsgtim,''hh24:mi:ss''),''--'') time_received_814_20,
case
   when trim(bad3700.nfcat_code) = ''SH01'' and zet.ext_ui is not null then ''ADDED''
   when trim(bad3700.nfcat_code) = ''SH01'' and zet.ext_ui is null then ''NOT PROCESSED''
   when trim(bad3700.nfcat_code) in (''SH02'',''SH03'') and zet.ext_ui is null then ''REMOVED''
   when trim(bad3700.nfcat_code) in (''SH02'',''SH03'') and zet.ext_ui is not null then ''NOT PROCESSED''
   else ''NOT PROCESSED''
end work_order_check
from
    (select distinct *
     from
        (select
         trunc(createdon) createdon,
         trim(notificatn) notificatn,
         trim(uc_pod_ext) uc_pod_ext,
         trim(not_type) not_type,
         trim(nfcat_code) nfcat_code,
         row_number () over (partition by trim(uc_pod_ext),trunc(createdon) order by trim(notificatn) desc) rnum
         from birpt.bic_azfc_ds3700
         where upper(trim(not_type)) = ''SH''
         and trim(bic_zdiscstat) = ''E0010'')
     where rnum = 1
    ) bad3700
left outer join
    (
     select distinct ucinstalla, uc_pod_ext, datefrom, dateto
     from birpt.bi0_qucinstalla
     where objvers = ''A''
    ) bqi
    on (trim(bad3700.uc_pod_ext) = trim(bqi.uc_pod_ext)
        and trunc(bad3700.createdon) between bqi.datefrom and bqi.dateto)
left outer join
    (
     select distinct cacont_acc, ucinstalla, ucmovein_d, ucmoveoutd
     from birpt.bi0_puccontract
     where objvers = ''A''
    ) bpc
    on (trim(bqi.ucinstalla) = trim(bpc.ucinstalla)
        and trunc(bad3700.createdon) between bpc.ucmovein_d and bpc.ucmoveoutd)
left outer join 
    (select distinct * 
     from 
        (select
         trim(ucswtpodex) ucswtpodex,
         trunc(ucswmsgdat) ucswmsgdat,
         ucswmsgtim,
         case  --650_01 CHECK
            when trim(uc_mdcat) = ''Z51'' then ''Yes''
            else ''No''
         end sent_650_01,
         row_number () over (partition by trim(ucswtpodex), trunc(ucswmsgdat) order by trunc(ucswmsgdat) desc, ucswmsgtim desc) rnum
         from birpt.bic_azudeds0300
         where trim(uc_mdcat) = ''Z51'') 
     where rnum = 1) ba300_z51
     on (trim(bad3700.uc_pod_ext) = trim(ba300_z51.ucswtpodex)
         and trunc(bad3700.createdon)= trunc(ba300_z51.ucswmsgdat))
left outer join
    (select distinct * 
     from 
        (select
         trim(ucswtpodex) ucswtpodex,
         trunc(ucswmsgdat) ucswmsgdat,
         ucswmsgtim,
         case  --650_02 CHECK
            when trim(uc_mdcat) = ''Z52'' then ''Yes''
            else ''No''
         end received_650_02,
         row_number () over (partition by trim(ucswtpodex), trunc(ucswmsgdat) order by trunc(ucswmsgdat) desc, ucswmsgtim desc) rnum
         from birpt.bic_azudeds0300
         where trim(uc_mdcat) = ''Z52'') 
     where rnum = 1) ba300_z52
     on (trim(bad3700.uc_pod_ext) = trim(ba300_z52.ucswtpodex)
         and trunc(bad3700.createdon)= trunc(ba300_z52.ucswmsgdat))
left outer join
    (select distinct * 
     from 
        (select
         trim(ucswtpodex) ucswtpodex,
         trunc(ucswmsgdat) ucswmsgdat,
         ucswmsgtim,
         case  --814_20 CHECK
            when trim(uc_mdcat) = ''Z20'' then ''Yes''
            else ''No''
         end received_814_20,
         row_number () over (partition by trim(ucswtpodex), trunc(ucswmsgdat) order by trunc(ucswmsgdat) desc, ucswmsgtim desc) rnum
         from birpt.bic_azudeds0300
         where trim(uc_mdcat) = ''Z20'') 
     where rnum = 1) ba300_z20
     on (trim(bad3700.uc_pod_ext) = trim(ba300_z20.ucswtpodex)
         and trunc(bad3700.createdon)= trunc(ba300_z20.ucswmsgdat))
left outer join
    (select distinct ext_ui
     from isurpt.zcs_esiid_tamper
    ) zet
    on (trim(bad3700.uc_pod_ext) = trim(zet.ext_ui));

1 个答案:

答案 0 :(得分:0)

如果删除所有双精度单引号(在任何文本编辑器中执行 replace 函数),则代码将是有效(就语法而言)。

我没有要对其进行测试的表,并且其中有太多的列和列太多,无法由我自己创建测试用例。

问题是:为什么首先要把它们加倍?