I have this function
create or replace
FUNCTION IFRS_FUNCTION_TEST RETURN NUMBER IS
estado NUMBER;
excepciones NUMBER;
title_code VARCHAR2(150 char);
colgaap_code VARCHAR2(150 char);
ifrs_code VARCHAR2(150 char);
v_causacion VARCHAR2(150 char);
pyg_diario_value VARCHAR2(150 char);
fecha_valoracion VARCHAR2(150 char);
pyg_dialogo VARCHAR2(150 char);
CURSOR ifrscursor IS SELECT no_asignado_por_la_entidad, codigo_puc FROM IFRS_351 WHERE no_asignado_por_la_entidad LIKE 'W%' FOR UPDATE;
BEGIN
BEGIN
estado:=0;
excepciones:=0;
OPEN ifrscursor;
LOOP
FETCH ifrscursor INTO title_code, colgaap_code;
EXIT WHEN ifrscursor%NOTFOUND;
SELECT cta_ifrs into ifrs_code FROM ifrs_tabla_homo_351 WHERE codigo_puc_colgaap = colgaap_code;
UPDATE IFRS_351 SET codigo_puc = ifrs_code WHERE CURRENT OF ifrscursor;
BEGIN
SELECT saldo, pyg_diario into v_causacion, pyg_diario_value FROM IFRS_INV_OBL WHERE nro_titulo=title_code;
UPDATE IFRS_351 SET vr_mercado_o_valor_presente_ = v_causacion, causacion_valoracion_cuentas = pyg_diario_value WHERE CURRENT OF ifrscursor;
EXCEPTION WHEN NO_DATA_FOUND THEN
excepciones:=excepciones+1;
END;
END LOOP;
CLOSE ifrscursor;
EXCEPTION WHEN OTHERS THEN
estado:=SQLCODE;
END;
RETURN(estado);
How can I get the estado value of this function with Java EntityManager? I tried with
SELECT IFRS_FUNCTION_TEST() FROM DUAL;
but I always obtain the error code 14551.
The value -14551 is actually an Oracle error rather than a value. The error is detailed below and should give more details on exactly why it's not working.
ORA-14551 cannot perform a DML operation inside a query Cause: DML operation like insert, update, delete or select-for-update cannot be performed inside a query or under a PDML slave. Action: Ensure that the offending DML operation is not performed or use an autonomous transaction to perform the DML operation within the query or PDML slave.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With