【问题标题】:encountered the symbol "end" when expecting one of the following预期以下之一时遇到符号“结束”
【发布时间】:2012-10-21 18:53:01
【问题描述】:

在下面的过程中,我做错了,我没有找到我出错的地方,“在期待以下之一时遇到符号”结束“请帮助我并用 wat 解释程序中的错误。

create or replace PROCEDURE CRangeproc(in_termid IN VARCHAR2,in_cardno IN VARCHAR2,p_ResultSet OUT SYS_REFCURSOR,outcount OUT NUMBER)
AS 
BEGIN 
select count(*) into outcount from cardrangetable where PAN_LOW <= in_cardno AND  PAN_HIGH >=   in_cardno and terminal_id = in_termid;
IF outCount = 1 then
Open p_ResultSet FOR    
select ISSUERTABLEID,ACQUIRERTABLEID,PANLENGTH from cardrangetable where PAN_LOW <= in_cardno  AND  PAN_HIGH >= in_cardno and terminal_id = intermid;
CLOSE p_ResultSet;
else
end if; 
End CRangeproc;

提前致谢

【问题讨论】:

    标签: oracle stored-procedures plsql oracle10g oracle11g


    【解决方案1】:

    PL/SQL 不允许像其他语言那样使用空块。 One way to circumvent this is to put a NULL; statement 没有其他声明的地方:

    IF outcount = 1 THEN
      OPEN p_resultset FOR [...]
    
      CLOSE p_resultset;
    ELSE
      NULL; -- The NULL statement
    END IF; 
    

    【讨论】:

      【解决方案2】:

      在 else 和 end if 之间需要一些代码。或者只是删除其他:

      begin
         select count(*)
           into outcount
           from cardrangetable
          where pan_low <= in_cardno
            and pan_high >= in_cardno
            and terminal_id = intermid;
         if outcount = 1
         then
            open p_resultset for
               select issuertableid
                     ,acquirertableid
                     ,panlength
                 from cardrangetable
                where pan_low <= in_cardno
                  and pan_high >= in_cardno
                  and terminal_id = intermid;
            exit when p_resultset%notfound;
            close p_resultset;
         else
            -- You need some code here or remove the else.
         end if;
      end crangeproc;
      

      【讨论】:

      • 好的,谢谢,仍然有一些错误,例如“SQL语句被忽略”
      • 我发现我使用的是 intermid 而不是 in_termid
      猜你喜欢
      • 1970-01-01
      • 2015-02-04
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多