Ignored INSERT clause in the past

Asked

Viewed 33 times

0

I’m having a problem that I’m already starting to believe is lack of faith.

I have a proc that performs a series of Inserts and updates. She goes through the first Insert and for the first update and carries out what is proposed. In the other Inserts, apparently the clause Insert is ignored in proc. The select concerning the Insert in question returns data, if I take the block and run separately in another window it effectively does the Insert and by placing a DBMS_OUTPUT in proc just below each Insert, it is possible to see that he passes by there normally, just does not do what is proposed.

In short, he executes the first two commands and the rest he ignores, even going through them.

Does anyone have any idea what this might be?

As an example, it follows a fragment of proc and the output of DBMS:


--The previous command executes an Insert that effectively populates the order table correctly with the parameters passed
--After, we have this Insert followed by other Inserts in other tables, but that are similar
--At the end of each Insert, I put a DBMS_OUTPUT, which returns the message of having passed there
--Taking each Insert and running separately, they work, but in proc not

begin
 INSERT INTO BANCO.PED_COMPL_PEDIDO   (
         EMPRESA,
          PEDIDO,
          DAT_HOR_INCLUSAO,
          USUARIO_INCLUSAO,
          PORTADOR,
          TIP_PORTADOR,
          FORMA_PAGTO,
          FINALIDADE_USO,
          TIP_DESC,
          EMISSAO_PEDIDO,
          PROCESSO_EXPORT,
          EMPRESA_VENDA
          )
select    
         'FF' ,--EMPRESA
          pedidos.num_pedido, --PEDIDO
          sysdate, --DAT_HOR_INCLUSAO
          'user ', --USUARIO_INCLUSAO
          '', --PORTADOR
          '', --TIP_PORTADOR
          '', --FORMA_PAGTO
          '', --FINALIDADE_USO
          '', --TIP_DESC
          '', --EMISSAO_PEDIDO
          '', --PROCESSO_EXPORT
          '' --EMPRESA_VENDA
          from BANCO.pedidos
          where pedidos.cod_empresa= 'FF'
          and pedidos.dat_pedido= vDataEmissao
          and pedidos.NUM_PEDIDO_CLI = idEntrega
          and pedidos.num_pedido not in (select pedido from BANCO.PED_COMPL_PEDIDO
                           where usuario_inclusao='clientUser '
                           and DAT_HOR_INCLUSAO >=(sysdate-60));
DBMS_OUTPUT.PUT_LINE('Passou pela PED_COMPL_PEDIDO');

commit;

DBMS_OUTPUT.PUT_LINE('-----------------------------');
DBMS_OUTPUT.PUT_LINE(vDataEmissao || ' Data emissão');
DBMS_OUTPUT.PUT_LINE(idEntrega || ' id Entrega');
DBMS_OUTPUT.PUT_LINE('-----------------------------');

end;

The exit from the DBMS was this:

Passed by PED_COMPL_PEDIDO

30/10/17 Date of issue
27583545 id Delivery

  • 1

    Edit your question with your own procedure to make it easier for us to help.

  • 1

    If possible put the code snippet and try to dig deeper into what you are trying to do and how do you think?

  • Guys, I made an issue with a fragment of it. Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.