1. Pete Yankovich
  2. PowerBuilder
  3. Friday, 9 April 2021 17:00 PM UTC

I'm getting the "Mismatch between retrieve columns and fetch columns" error when calling a sql server proc with output parm. These are the particulars:

PB 2017 R2

See attached for SQL Server specs

It's important to note that the PB app has other stored proc calls with same format as this call and they work fine.

And, if this proc is called from SQL Server, it correctly returns the OUTPUT value.

PB Code:

Var li_update is integer

// Run the stored proc to reprocess if update was successful.
// The proc returns 1 for success and 0 for failure in OUTPUT parm.
// The proc does its own transaction processing.
DECLARE ap_Meter_Ticket_Process PROCEDURE FOR dbo.ap_Meter_Ticket_Process
@IsReprocess = :ls_fl_reprocess,
@Id_user = :ls_id_user,
@rtn = :li_update OUTPUT;

EXECUTE ap_Meter_Ticket_Process;

if sqlca.sqlcode = 0 then
// Retrieve proc return code
FETCH ap_Meter_Ticket_Process INTO :li_update;

if sqlca.sqlcode <> 0 then
// Fetch Failure
li_update = -1
ls_sql_msg = sqlca.sqlerrtext
else
// Fetch Success
if li_update = 0 then
// Reprocess failed
ls_sql_msg = "Refer to email for failure details"
end if
end if
else
li_update = -1
ls_sql_msg = sqlca.sqlerrtext
end if

CLOSE ap_Meter_Ticket_Process;

SQL Server Code:

All parms have a default value as the proc is called from a SQL Agent job without parms

Var @rtn defaults to 1 for success and if the proc encounters any error situations, @rtn gets set to 0 for failure

ALTER proc [dbo].[ap_Meter_Ticket_Process]
(
@IsReprocess varchar(1) = 'N',
@Id_user varchar(30) = 'NONE',
@rtn int = 1 OUTPUT
)

Any help is appreciated

Pete

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 9 April 2021 18:05 PM UTC
  2. PowerBuilder
  3. # 1

Hi Pete;

   Have you tried an SQL Trace between the App that fails and the one that works?

SQLCA.DBMS = "TRACE XXX"

  Then check what the differences are - including DB connection settings.

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.