Kbase 21920: Data Server -- Error 2004 Running Stored Procedures
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/29/2002 |
|
SUMMARY:
This Solution explains what might lead to error 2004 when using stored procedures with the DataServer in Progress Version 9.1x.
CLOSE STORED-PROC <proc-name> was called before fetching all the
results. (2004)
The stored procedure compiles OK, but errors out when the following code attempts to call the procedure:
def var hvnd as char format "x(9)".
hvnd = "000055555".
run stored-proc csrqis (hvnd).
close stored-proc csrqis.
EXPLANATION:
Whenever a stored procedure is run and there is a result set returned successfully, the DataServer expects the caller to retrieve that result set. If the call failed to retrieve it, the ODBC_PROCCLS_ERROR is issued, which in turn, prints error 2004 because the caller is trying to close out the stored procedure without ever reading all the results returned from it.
SOLUTION:
Add the following code or define your own buffer to retrieve the result:
FOR EACH proc-text-buffer:
DISPLAY proc-text-buffer.
References to Written Documentation:
DataServer for MS SQL Server Guide