Código para llamar a una función en un paquete desde C # y ODP.NET
He intentado escribir código C # con ODP.NET para llamar a una función en un paquete. Estoy recibiendo los dos errores a continuación:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to INSERT_FUNC'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06550: line 1, column 7:
PLS-00221: 'INSERT_FUNC' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
MiOracleCommand
se configura como:
cmd.CommandText = "PKG_NAME.INSERT_FUNC";
cmd.CommandType = CommandType.StoredProcedure;
¿Cómo debo pasar los parámetros a la función de abajo?¿Necesito agregar unReturnValue
¿parámetro? He visto muchos foros discutiendo la necesidad de agregar unReturnValue
parámetro como el primeroOracleParameter
sobre elOracleCommand
objeto.Apreciaria cualquier sugerencia.
CREATE OR REPLACE
PACKAGE BODY pkg_name IS
FUNCTION insert_func (
i_description IN tableName.description%TYPE,
i_theme IN tableName.theme%TYPE,
o_id OUT tableName.id%TYPE,
o_error_msg OUT VARCHAR2 )
RETURN NUMBER
IS
l_program VARCHAR2(100) := 'PKG_NAME.INSERT_FUNC';
BEGIN
INSERT INTO tablea ( event_id, id, description, theme, lock_version )
VALUES ( rms12.tablea_seq.NEXTVAL, rms12.tablea_id_seq.NEXTVAL, i_description, i_theme, NULL );
INSERT INTO tableb ( id, description, theme )
VALUES ( rms12.id_seq.CURRVAL, i_description, i_theme );
SELECT rms12.id_seq.CURRVAL
INTO o_id
FROM dual;
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
o_error_msg := sql_lib.create_msg(
'PACKAGE_ERROR', SQLERRM, l_program, TO_CHAR( SQLCODE ) );
RETURN 0;
END insert_func;
END pkg_name;