create or alter procedure SPUI_NFS_REF (
    NFS_CONTROLE integer,
    CONTROLE integer,
    NUMERO_NOTAFISCAL integer,
    SERIE varchar(3),
    DATA_EMISSAO date,
    CFOP_CODIGO varchar(5),
    CHAVE_ACESSO varchar(44))
as
BEGIN
UPDATE OR INSERT INTO TBNFS_REFERENCIADA (NFS_CONTROLE,CONTROLE,NUMERO_NOTAFISCAL,
SERIE, DATA_EMISSAO, CFOP_CODIGO, CHAVE_ACESSO) VALUES (
:NFS_CONTROLE, :CONTROLE,:NUMERO_NOTAFISCAL,:SERIE, :DATA_EMISSAO,
:CFOP_CODIGO, :CHAVE_ACESSO)
MATCHING(NFS_CONTROLE, CONTROLE);
END;