首页 新闻 会员 周边

求助:Oracle存储过程错误问题

0
悬赏园豆:20 [已解决问题] 解决于 2016-03-10 15:19

create or replace procedure pro_hbjc_info_upload_table is

    v_station_id varchar2(50);
    v_station_id2 varchar2(50);
    v_count number;
    v_count2 number;
    v_cpys varchar2(5);
    v_hlb varchar2(5);
    v_is_upload varchar2(50);
    v_ccdjrq varchar2(50);
    v_ffrq varchar2(15);
    v_yxq varchar2(15);
    v_ywlx varchar2(15);
    v_cjh varchar2(300);

begin
    for t in (select bzbh,hphm,hpzl,acl_mod,cllx,cjh,ccdjrq ,rlzl,hlb,class,syxz,fbsj,expire_time,fbry from env_t_env_info)  
loop  
    select count(1) into v_count from t_check_result where vehicle_tag_no = '粤'||t.bzbh and vehicle_no_color = t.hpzl;
    if v_count = 0 then
    v_is_upload := '0';
    else
       select rm.station_id into v_station_id
       from (select station_id
          from t_check_result
           where vehicle_tag_no = '粤'|| t.bzbh
           and vehicle_no_color = t.hpzl
           order by update_time desc) rm
           where rownum <= 1;
       v_station_id2 := getStationCodeById(v_station_id);
    end if;
    if t.hpzl = '01' or t.hpzl = '16' then
    v_cpys := '1';
    elsif t.hpzl = '02' then
    v_cpys := '0';
    else
    v_cpys := '3';
    end if;
    v_ccdjrq := to_char(t.ccdjrq,'yyyy-mm-dd');
    if t.hlb = 1 then
    v_hlb := '0';
    else  
    v_hlb :='1';
    end if;
    v_cjh := deinsdad(t.cjh,'1111111122222222');
    v_ffrq := to_char(t.fbsj,'yyyy-mm-dd');
    v_yxq := to_char(t.expire_time,'yyyy-mm-dd');
    select count(1) into v_count2 from env_t_env_info_log where hphm=t.hphm and hpzl=t.hpzl;
    if v_count2 > 1 then
       v_ywlx := '3';
    else
       v_ywlx := '1';
    end if;
       insert into T_HBJC_INFO_UPLOAD(LABELNO,LICENSE,LICENSETYPE,VEHICLEMODEL,VEHICLETYPE,VIN,REGISTERDATE,FUELTYPE,LABELTYPE,STANDARD,USETYPE,GIVEDATE,AVILDDATE,STATIONCODE,PRINTOPERATOR,BUSINESSSORTS)
                           values(t.bzbh,t.hphm,v_cpys,t.acl_mod,t.cllx,v_cjh,v_ccdjrq,t.rlzl,v_hlb,t.class,t.syxz,v_ffrq,v_yxq,v_station_id2,t.fbry,v_ywlx);
commit;
exception

when others then
   null;
end loop;
end;

错误:PLS-00103: 出现符号 "EXCEPTION"在需要下列之一时:
        begin case declare
          end exit for goto if loop mod null pragma raise return select
          update while with <an identifier>
          <a double-quoted delimited-identifier> <a bind variable> <<
          close current delete fetch lock insert open rollback
          savepoint set sql execute commit forall merge pipe
行:57
文本:exception

错误:PLS-00103: 出现符号 "end-of-file"在需要下列之一时:
        ;
行:62

求解!

执着的脚步的主页 执着的脚步 | 初学一级 | 园豆:186
提问于:2016-03-10 09:56
< >
分享
最佳答案
0

将EXCEPTION放在LOOP循环外

执着的脚步 | 初学一级 |园豆:186 | 2016-03-10 11:00
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册