ok I called GetExpenseById stored proc using DECLARE-EXECUTE-FETCH-CLOSE and it worked. In PB I use a blob variable to store value of rowv column of the row retrieved.
Then I called UpdateExpense stored proc using DECLARE-EXECUTE-CLOSE and it failed on EXECUTE. This is the error information in SQLCA:
SQLCode = -1
SQLDBCode = 257
SQLErrText =
SQLSTATE = 42000
Microsoft OLE DB Provider for SQL Server
Implicit conversion from data type varchar to timestamp is not allowed. Use the CONVERT function to run this query.
How come? Is PB treating that value in blob as varchar?
This is the PB code:
longlong lll_expense_trans_id
long ll_expense_code
dec{2} ldc_expense_amount
blob lbl_rowv
lll_expense_trans_id = 1
DECLARE GetById PROCEDURE FOR GetExpenseById
@a_expense_trans_id = :lll_expense_trans_id
USING SQLCA;
EXECUTE GetById;
FETCH GetById INTO
:lll_expense_trans_id,
:ll_expense_code,
:ldc_expense_amount,
:lbl_rowv;
CLOSE GetById;
DECLARE UpdateById PROCEDURE FOR UpdateExpense
@a_expense_trans_id = :lll_expense_trans_id,
@a_expense_code = :ll_expense_code,
@a_expense_amount = :ldc_expense_amount,
@a_rowv = :lbl_rowv
USING SQLCA;
EXECUTE UpdateById;
CLOSE UpdateById;