1

I see many similar questions, but I can't see what could be wrong here. I have the following very simple Oracle SP:

create or replace PROCEDURE "SP_PERSONAS_PADRON_BIENES"
(
  pcod_organizacion in number, 
  pnum_cedula in varchar2,
  pnum_bienes in number,
  pind_bienes in number, 
  ptip_bienes in number,
  pdes_bienes in varchar2, 
  pval_bienes in number,
  pfec_adquisicion in varchar2,
  ptip_modo   in  varchar2
) --tipo de modo I insertar U actualizar B borrar 
is
  vlcod_return number(4);                          --variable para almacenar el codigo de error de retorno.
  vlmsg_return tbl_errores.des_error%type := '';   --variable para almacenar el mensaje de retorno.
  vlnum_siguiente number(4) :=1;                   --siguiente numero de Bien para esta cedula.
  errorgenerico exception;
begin
    INSERT INTO debug values(pnum_cedula);
    if ptip_modo = 'AGREGAR_NORMAL' or ptip_modo = 'A' then  
        begin
            --recuperar el ultilmo mas 1
            begin
                select nvl(max(num_bienes),0) into vlnum_siguiente
                from tbl_personas_padron_bienes
                where cod_organizacion = pcod_organizacion
                and num_cedula       = pnum_cedula;

                vlnum_siguiente := vlnum_siguiente + 1;
            exception
                when no_data_found then 
                    vlnum_siguiente := 1;
                when others then 
                    vlnum_siguiente := 1;
            end; 

            insert into tbl_personas_padron_bienes (cod_organizacion,num_cedula,num_bienes,ind_bienes,tip_bienes,des_bienes,val_bienes ,fec_adquisicion, usu_incluye, fec_incluye, usu_modifica, fec_modifica)
            values (pcod_organizacion, pnum_cedula, vlnum_siguiente, pind_bienes, ptip_bienes, pdes_bienes, pval_bienes , pfec_adquisicion, user, sysdate, user, sysdate); 
        end;
    end if;
end;

If I execute it from SQL Developer doing EXEC SP_PERSONAS_PADRON_BIENES .... it does what is expected. But when I call it from C#, it gives me this error:

ORA-06550: line 1, column 34: PLS-00103: Encountered the symbol "" when expecting one of the following: := . ( @ % ;

private async Task EjecutarSpPersonasPadronBienes( Bien bien, string modo, string credencialesEncriptadas )
        {
            var credenciales = Encriptacion.ObtenerCredenciales( credencialesEncriptadas );
            var connection = new OracleConnection( Seguridad.CadenaDeConexion( credenciales, _connectionString ) );
            var command = connection.CreateCommand();
            command.Parameters.Add("pcod_organizacion", OracleDbType.Int32, bien.CodigoOrganizacion, ParameterDirection.Input );
            command.Parameters.Add("pnum_cedula", OracleDbType.Varchar2, bien.Cedula, ParameterDirection.Input );
            command.Parameters.Add("pnum_bienes", OracleDbType.Int32, bien.Id, ParameterDirection.Input );
            command.Parameters.Add("pind_bienes", OracleDbType.Int32, bien.TieneBienesInscritos, ParameterDirection.Input );
            command.Parameters.Add("ptip_bienes", OracleDbType.Int32, bien.Tipo, ParameterDirection.Input );
            command.Parameters.Add("pdes_bienes", OracleDbType.Varchar2, bien.Descripcion, ParameterDirection.Input );
            command.Parameters.Add("pval_bienes", OracleDbType.Double, bien.ValorEstimado, ParameterDirection.Input );
            command.Parameters.Add("pfec_adquisicion", OracleDbType.Varchar2, bien.FechaAdquisicion.ToString( "dd/MM/yyyy" ), ParameterDirection.Input );
            command.Parameters.Add("ptip_modo", OracleDbType.Varchar2, modo, ParameterDirection.Input );

            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "SP_PERSONAS_PADRON_BIENES";
            connection.Open();
            await command.ExecuteNonQueryAsync();

            if( connection.State == ConnectionState.Open )
            {
                connection.Close();
            }
        }//EjecutarSpPersonasPadronBienes

I have a lot of calls like that, but this is the only one that is failing.

jtorrescr
  • 627
  • 4
  • 13

1 Answers1

0

So as commented by @madreflection "You have a zero-width character at the end of the procedure name, i.e. between the "S" and the quote. Oddly enough, it's the BOM character, or Zero-Width No-Break Space, U+FEFF."

The problem was a special character in the string with the Stored Procedure Name, I just removed the text and retyped it, and if fixed the problem.

jtorrescr
  • 627
  • 4
  • 13