Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Fabio Carvalho

Chamar Function de uma Package em C#

Question

Ola Pessoal.

Criei a procedure abaixo com algumas funções.

create or replace package body PK_LF_CONTROLEADEQUACAO is
  C_SIM constant number := 1;
  C_NAO constant number := 0;
  v_commit number;
  r_mess   character;

  --TIPO DE SERVIÇO ---------------------------------------------------------------------------------------------------

function AtualizaTipoServico(p_acao   in varchar2,
                               p_idserv in number,
                               p_nome   in varchar2,
                               p_desc   in varchar2,
                               p_compl  in varchar2) return varchar2 is
    v_idserv number;
  begin
    -- Cadastra Tipo de Serviço se não Existir
    v_commit := 1;
    CASE p_acao
      WHEN 'ADD' THEN
      
        begin
          select nvl(count(*), 0)
            into v_idserv
            from lf_tiposervicos ts
           where ts.nome = p_nome
              or ts.idserv = p_idserv;
        exception
          when others then
            v_idserv := 0;
        end;
      
        if v_idserv > 0 then
          DBMS_OUTPUT.PUT_LINE('já Existe este Seviço cadastrado' ||
                               SQLERRM);
          r_mess   := 'sucesso';
          v_commit := C_NAO;
        else
        
          --Busca Ultimo Id Serviço
          select max(ts.idserv) into v_idserv from lf_tiposervicos ts;
        
          if v_idserv is null then
            v_idserv := 0;
          End If;
          v_idserv := v_idserv + 1;
        
          --Insere Seriço   
          insert into lf_tiposervicos ts
            (idserv, nome, descserv, complemento)
          values
            (v_idserv, p_nome, p_desc, p_compl);
        end if;
      
    END CASE;
  
    return ' ';
  end;

Ao tentar a função no VS 13. atraves do código abaixo, 

 if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    try
                    {
                        OracleCommand command = new OracleCommand();
                        command.Connection = conn;
                        command.CommandText = "PK_LF_CONTROLEADEQUACAO.AtualizaTipoServico";
                        command.CommandType = CommandType.StoredProcedure;

                        command.Parameters.Add("@p_acao", "ADD");
                        command.Parameters.Add("@p_idserv", "0");
                        command.Parameters.Add("@p_nome", txtTipoServico.Text);
                        command.Parameters.Add("@p_desc", txtDescricaoTipoServico.Text);
                        command.Parameters.Add("@p_compl", "");
                        command.ExecuteNonQuery()

Estou recebendo o erro

"{"ORA-06550: line 1, column 7:\nPLS-00221: 'ATUALIZATIPOSERVICO' is not a procedure or is undefined\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored"}"

 

Poderiam me ajudar a identificar onde estou errando.

 

Grato

Edited by Fabio Carvalho

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148448
    • Total Posts
      643906
×
×
  • Create New...