首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >操作步骤: PLS - 00103错误

操作步骤: PLS - 00103错误
EN

Stack Overflow用户
提问于 2014-02-14 23:24:10
回答 2查看 85关注 0票数 0

我有一个从一个表到另一个表的事务处理过程。我已经完成了代码,但得到的结果是这个错误

Error(89,59): PLS-00103: Encountered the symbol ";" when expecting one of the following: * & = - + < / > at in is mod remainder not rem then <expoente (**)> <> or != or ~= >= <= <> and or like LIKE2_ LIKE4_ LIKEC_ between overlaps || multiset year DAY_ member SUBMULTISET_

我不知道我做错了什么!

下面是我的代码:

代码语言:javascript
复制
    create or replace procedure arm_inst (
    p_cod_armazem_zona in varchar2,
    p_cod_instituicao in varchar2)

is 
    qn_cg_pd number(8);
    qn_cm_pd number(8);
    qn_cp_pd number(8);
    qn_cg_ar number(8);
    qn_cm_ar number(8);
    qn_cp_ar number(8);
    estado_pd char (8);
begin
    select estado_ped
    into estado_pd
    from pedidos 
    where cod_instituicao = p_cod_instituicao;

    select quantidade_az_cg, quantidade_az_cm, quantidade_az_cp
    into qn_cg_ar, qn_cm_ar, qn_cp_ar
    from armazem_zona
    where armazem_zona = p_cod_armazem_zona;    

if (estado_pd = 'Pendente') then
  select quantidade_pedida_cg, quantidade_pedida_cm, quantidade_pedida_cp
  into qn_cg_pd, qn_cm, qn_cp
    from pedidos
    where cod_instituicao = p_cod_instituicao;

        if(qn_cg_pd <= qn_cg_ar) then -- verifica quantidade cabazes grandes
            update pedidos
            set estado_ped = 'Aprovado' --se e verdadeira da aprovado
            where cod_instituicao = p_cod_instituicao;

            update armazem_zona -- faz update da tabela armazem com as 
            set qn_cg_ar = qn_cg_ar - qn_cg_pd -- quantidades
            where cod_armazem_zona = p_cod_armazem_zona;
      commit;
        else if(qn_cg_pd > qn_cg_ar)then -- se nao for verdadeira da recusado
            update pedidos
            set estado_pd = 'Recusado'
            where cod_instituicao = p_cod_instituicao;
    end if;
        end if;
        if(qn_cm_pd <= qn_cm_ar)then --verifica quantidade cabazes medias
            update pedidos 
            set estado_pd = 'Aprovado'
            where cod_instituicao = p_cod_instituicao;

            update armazem_zona
            set qn_cm_ar = qn_cm_ar - qn_cm_pd
            where cod_armazem_zona = p_cod_armazem_zona;

        else if(qn_cm_pd > qn_cm_ar)then-- condicao é falsa
            update pedidos
            set estado_pd = 'Recusado'
            where cod_instituicao = p_cod_instituicao;
    end if;
        end if;
        if(qn_cp_pd <= qn_cp_ar) then
            update pedidos
            set estado_pd = 'Aprovado'
            where cod_instituicao = p_cod_instituicao;

            update armazem_zona 
            set qn_cp_ar = qn_cp_ar - qn_cp_pd
            where cod_armazem_zona = p_cod_armazem_zona;
        else if(qn_cp_pd > qn_cp_ar) then 
            update pedidos
            set estado_pd = 'Recusado'
            where cod_instituicao = p_cod_instituicao;
        end if;
    end if;

        select estado_pd 
        from pedidos
        where cod_instituicao = p_cod_instituicao;
        if (estado_pd = 'Aprovado') then
            update pedidos
            set estado_pd = 'Aprovado'
            where cod_instituicao = p_cod_instituicao;
        else if (estado_pf != 'Aprovado') then
            update pedidos
            set estado_pd = 'Reprovado'
            where cod_instituicao = p_cod_instituicao;
    end if;
    end if;

        elsif (dbms_output.put_line('O pedido já foi avaliado'));
        end if;
commit;
end;

任何帮助都将不胜感激!:)

EN

回答 2

Stack Overflow用户

发布于 2014-02-14 23:32:13

在代码的末尾:

代码语言:javascript
复制
select estado_pd 
from pedidos
where cod_instituicao = p_cod_instituicao;

if (estado_pd = 'Aprovado') then

它缺少一个

代码语言:javascript
复制
INTO estado_pd

在您的select语句中。

票数 1
EN

Stack Overflow用户

发布于 2014-02-14 23:36:00

第89行似乎是这样的:

代码语言:javascript
复制
elsif (dbms_output.put_line('O pedido já foi avaliado'));

elsif需要一个测试;不确定您是要检查其他内容来决定是否显示该消息,还是只是想要一个else

代码语言:javascript
复制
else
  dbms_output.put_line('O pedido já foi avaliado');
end if;

使用更一致的缩进可能会更容易一些……

这就是你询问的特定PLS-00103的原因,但这只是它在这种情况下报告的第一个错误-在深入研究语句语法之前,它似乎是因为结构错误而放弃了。正如CorradoPiola所指出的,您至少在select的第75行遗漏了一个into,并且随着编译器在每次更正之后的深入,可能还会有其他的遗漏。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21783156

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档