I need get the output of a VARCHAR2 variable in PRO*C. This variable comes from a Oracle procedure. This is the thing:

This work fine,

bzero(d_fecha_ejecucion.arr,20); 
 EXEC SQL SELECT
 TO_CHAR(SYSDATE,'dd-mon-yy hh24:mi:ss') INTO :d_fecha_ejecucion FROM
 DUAL;           
 sprintf(c_msg,"--->FECHA EJECUCIÓN: [%s]",(char *)d_fecha_ejecucion.arr);

But when I try to get a variable (VARCHAR SV_desc_error) from procedure like this:

 EXEC SQL EXECUTE
 BEGIN
 PACKAGE.PROCEDURE_PR(:SN_num_ev, :SN_cod_msjerror,:SV_desc_error);
 END;
END-EXEC;

bzero(SV_desc_error.arr,4000);
SV_desc_error.len = (unsigned short)strlen((char *)SV_desc_error.arr);

sprintf(c_msg,"--->Out PACKAGE.PROCEDURE_PR(SN_num_ev: [%d],SN_cod_msjerror: [%d],SV_desc_error: [%s])",SN_num_evento,SN_cod_msjerror,(char *)SV_desc_error.arr);

Don't work...the variable return empty

I test with a anonymous block and works...

So, who i can get this variable? Thank.

有帮助吗?

解决方案

In your code, you are setting "bzero" AFTER your code execution, which should be wiping out any value you might have returned.

Correct this and rerun.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top