Skip to Content
0
Sep 24, 2019 at 09:03 PM

Error opening the cursor for the remote database Unknown value:PARAMETER for query sql hana

1241 Views Last edit Sep 25, 2019 at 09:53 PM 2 rev

Hi Experts,

I am having a data type conversion problem, when I am creating a stored procedure with a parameter where:

The table that reads is from a BW on Hana

The date = "/ BIC / ZHCAPEEPI" of the "ODSLAYER" table. "V_ZHC_EPIS $ P" is of type VARCHAR (8)

When I make a call "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ7"('20190923'); if he answers me

but when I want to get data from the previous day I get the following error: "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ7"('19000101')

(SQL Editor) Could not execute 'call "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ7"('19000101')'
Error: (dberror) 403 - internal error: "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ7": line 32 col 0 (at pos 359): Error opening the cursor for the remote database Unknown value:PARAMETER for query "SELECT "V_ZHC_EPIS$P"."/BIC/ZHC_EPIS" FROM "BW.ZHC_EPIS$P" "V_ZHC_EPIS$P" WHERE "V_ZHC_EPIS$P"."/BIC/ZHCAPEEPI" = ? "


I have created 2 stored procedure which are the following:

CREATE PROCEDURE "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ7"(IN FECHAIN INTEGER) LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

AS BEGIN

DECLARE FECHACARGAINIVAR VARCHAR(8);

if :FECHAIN='19000101' then

SELECT TO_VARCHAR(ADD_DAYS(CURRENT_DATE,-1), 'YYYYMMDD') INTO FECHACARGAINIVAR FROM DUMMY;

else SELECT TO_VARCHAR(:FECHAIN) INTO FECHACARGAINIVAR FROM DUMMY;

end if;

SELECT "/BIC/ZHC_EPIS" FROM "ODSLAYER"."V_ZHC_EPIS$P" WHERE "/BIC/ZHCAPEEPI" = FECHACARGAINIVAR ;

END

CREATE PROCEDURE "ODSLAYER"."BORRAR_SP_CARGA_BW_BIZ8"(IN FECHAIN INTEGER) LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER AS

BEGIN DECLARE FECHACARGAINIVAR VARCHAR(8);

if :FECHAIN='19000101' then

SELECT TO_VARCHAR(ADD_DAYS(NOW(),-1), 'YYYYMMDD') INTO FECHACARGAINIVAR FROM DUMMY;

else SELECT TO_VARCHAR(:FECHAIN) INTO FECHACARGAINIVAR FROM DUMMY;

end if;

SELECT "/BIC/ZHC_EPIS" FROM "ODSLAYER"."V_ZHC_EPIS$P" WHERE "/BIC/ZHCAPEEPI" = FECHACARGAINIVAR ;

END

Because in the error it appears as if the parameter were null =? , when he debugged that parameter if he gives me information = '20190923',

which part of the code is incorrect, please could you help me.

I thank you in advance for your support

Keith C.

Attachments

datos-web.jpg (38.1 kB)
tabla-fecha.jpg (46.2 kB)
error-convetir.jpg (13.7 kB)
debug2.jpg (55.8 kB)