首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Informix >

存储过程语法异常 帮忙看上 小妹是菜鸟

2013-01-02 
存储过程语法错误 大虾帮忙看下 小妹是初学者if l_date8 then ( if timeoffset0 then let tmp_sjdmF_GE

存储过程语法错误 大虾帮忙看下 小妹是初学者
if l_date=8 then ( if timeoffset=0 then let tmp_sjdm=F_GET_SJDM(proddate,0);
                      elif timeoffset=1 then (let tmp_date = to_char((date(substr('proddate',5,2)||'/01/'||substr('proddate',1,4))- 1 ),'%Y%m%d');
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,0);
                                             )                       
                      elif timeoffset=2 then (let tmp_date = to_char((date(substr('proddate',5,2)||substr('proddate',7,2)||substr('proddate',1,4))- 1 UNITS YEAR),'%Y%m%d');
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,0);
                                             ) 
                      elif  timeoffset=3 then (let tmp_date = to_char((date('01/01/'||substr('proddate',1,4))- 1 ),'%Y%m%d');
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,0);
                                             )
                   end if;
                 )
  elif l_date=7 then (if timeoffset=0 then let tmp_sjdm=F_GET_SJDM(proddate,1);
                      elif timeoffset=1 then (let tmp_date = to_char((date(substr('proddate',5,2)||'/01/'||substr('proddate',1,4))- 1 ),'%Y%m')||'3';
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,1);
                                             )                       


                      elif timeoffset=2 then (let tmp_date = to_char((date(substr('proddate',5,2)||'/01/'||substr('proddate',1,4))- 1 UNITS YEAR),'%Y%m')||'3';
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,1);
                                             ) 
                      elif  timeoffset=3 then (let tmp_date = to_char((date('01/01/'||substr('proddate',1,4))- 1 ),'%Y')||'123';
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,1);
                                             )
                   end if;
                 )
  elif l_date=6 then (if timeoffset=0 then let tmp_sjdm=F_GET_SJDM(proddate,2);
                      elif timeoffset=1 then (let tmp_date = to_char((date(substr('proddate',5,2)||'/01/'||substr('proddate',1,4))- 1 ),'%Y%m');
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,2);
                                             )                       
                      elif timeoffset=2 then (let tmp_date = to_char((date(substr('proddate',5,2)||'/01/'||substr('proddate',1,4))- 1 UNITS YEAR),'%Y%m');
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,2);
                                             ) 


                      elif  timeoffset=3 then (let tmp_date = to_char((date('01/01/'||substr('proddate',1,4))- 1 ),'%Y')||'12';
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,2);
                                             )
                   end if;
                 )
  elif l_date=5 then (if timeoffset=0 then let tmp_sjdm=F_GET_SJDM(proddate,3);
                      elif timeoffset=1 then (
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,3)-1;
                                             )                       
                      elif timeoffset=2 then (let tmp_date = to_char((date('01/01/'||substr('proddate',1,4))- 1 ),'%Y')||substr('proddate',5,1);
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,3);
                                             ) 
                      elif  timeoffset=3 then (let tmp_date = to_char((date('01/01/'||substr('proddate',1,4))- 1 ),'%Y')||'4';
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,3);
                                             )
                   end if;


                  )
   elif l_date=4 then (if timeoffset=0 then let tmp_sjdm=F_GET_SJDM(proddate,4);
                      elif (timeoffset=1 or timeoffset=2 or timeoffset=3) then (
                                              let tmp_sjdm= F_GET_SJDM(tmp_date,3)-1;
                                             )                       
                      )
                   end if;
                   )  
    end if;

贴不全 报错的行数目前是在这部分
[解决办法]
看到了,系统好像不是同时的。
你的then后面的括号( 和对应的) 都要删调,另外你的格式要修改,像
if l_date=8 then  
  if timeoffset=0 then 
    let tmp_sjdm=F_GET_SJDM(proddate,0);
  elif timeoffset=1 then 
看起来也方便。

热点排行