Skip to main content

Hi ,

I have the following code in cobol program:

MOVE 1    TO SP-P-MEMBER-NO

EXEC SQL
call SP-GET-MEMBER-EMAIL(:SP-P-MEMBER-NO IN , :SP-O-EMAIL-ADDRESS OUT )
END-EXEC.

And below is my stored procedure :

CREATE OR REPLACE PROCEDURE SP_GET_MEMBER_EMAIL
(
p_memberNo in NUMBER
,o_emailAddress out VARCHAR2
)
as
begin
select email_addr
into o_emailAddress
from MEMBER_INFO
where member_no = p_memberNo;
END SP_GET_MEMBER_EMAIL;

When i call  the stored procedure from the cobol program , i get the following sql state and sql code

SQLSTATE 37000 

SQLCODE -0000010000

SQLERRMC Syntax error or access violation.

I have configured SQL Directive DBMAN=ODBC

The other scenario is where i dont use the Call statement to invoke th stored proc , i use the pro cobol syntax

EXEC SQL EXECUTE
  BEGIN SP_GET_MEMBER_EMAIL
  (:SP-P-MEMBER-NO
 ,:SP-O-EMAIL-ADDRESS);
 END;
END-EXEC.

In this case system gives error to Add PROCOB directive, when i add it then the Select queries fail.

Please  advice if anything is incorrect.

Hi ,

I have the following code in cobol program:

MOVE 1    TO SP-P-MEMBER-NO

EXEC SQL
call SP-GET-MEMBER-EMAIL(:SP-P-MEMBER-NO IN , :SP-O-EMAIL-ADDRESS OUT )
END-EXEC.

And below is my stored procedure :

CREATE OR REPLACE PROCEDURE SP_GET_MEMBER_EMAIL
(
p_memberNo in NUMBER
,o_emailAddress out VARCHAR2
)
as
begin
select email_addr
into o_emailAddress
from MEMBER_INFO
where member_no = p_memberNo;
END SP_GET_MEMBER_EMAIL;

When i call  the stored procedure from the cobol program , i get the following sql state and sql code

SQLSTATE 37000 

SQLCODE -0000010000

SQLERRMC Syntax error or access violation.

I have configured SQL Directive DBMAN=ODBC

The other scenario is where i dont use the Call statement to invoke th stored proc , i use the pro cobol syntax

EXEC SQL EXECUTE
  BEGIN SP_GET_MEMBER_EMAIL
  (:SP-P-MEMBER-NO
 ,:SP-O-EMAIL-ADDRESS);
 END;
END-EXEC.

In this case system gives error to Add PROCOB directive, when i add it then the Select queries fail.

Please  advice if anything is incorrect.

You are using hyphens for the stored procedure name in the COBOL CALL statement but the real name of the stored procedure contains underscores.

Change this to:

EXEC SQL

     call SP_GET_MEMBER_EMAIL(:SP-P-MEMBER-NO IN , :SP-O-EMAIL-ADDRESS OUT )        

END-EXEC.