Procedure de Update oracle

Asked

Viewed 34 times

0

Good morning!

I’m still a layman at BD and I’ve been catching a little bit. I would like, please, to know if you could help me with a given problem.

My scenario is as follows. I have two screens, a shopping portal and an xml import portal. I would like to make a procedure when invoicing an order by entering the key of the NF on request, on the compras, the status on the importação XML, was changed from pending to imported.

Today, it is expected by the system that, when processing the information of a invoice in the xml import portal, the NF key has already been used in the shopping portal. If so, he recognizes that the note has already been processed and then changes the status. What I want to do would be the opposite of that. By launching in the shopping portal, inserting the key of the NF, he was able to identify this key in the import portal.

I tried to make this code in countless ways and I was unsuccessful.

 CREATE OR REPLACE PROCEDURE AD_ATUALIZA_STATUS_XML (
P_STATUSNOTA IN TGFCAB.STATUSNOTA %TYPE -- Avalia se a nota está liberada para uso
P_STATUS IN     TGFIXN.STATUS %TYPE -- status da nota do portal de importação ( deve ser atualizado no update da procedure)
P_NUMNOTA IN    TGFIXN.NUMNOTA NOTA %TYPE -- numero da nota no portal de importação xml
P_CHAVECAB IN   TGFCAB.CHAVENFE %TYPE  -- chave da NF no portal de compras 
P_CHAVEXML IN   TGFIXN.CHAVEACESSO %TYPE --Chave da nf no portal de importação de xml 
P_TIPMOV IN     TGFTOP.TIPMOV %TYPE -- tipo de movimento compra
)
IS 
BEGIN 
    IF (P_CHAVECAB = P_CHAVEXML AND P_TIPMOV = 'C' AND P_STATUSNOTA = 'L') THEN -- verifica se  a chave do portal de compras e a chave do portal de importação xml é a mesma, se a nota é do tipo nota de compra e se está liberada para uso.
        UPDATE TGFIXN SET STATUS = 2 WHERE TGFIXN.NUMNOTA = P_NUMNOTA ;-- atualizada status de pendente para importada.
    ELSE 'CHAVE DA NOTA NÃO CORRESPONDE A CHAVE NO PORTAL DE IMPORTAÇÃO XML';
END IF;
--COMMIT;
END AD_ATUALIZA_STATUS_XML;
No answers

Browser other questions tagged

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