Sybase Stored Procedure w/ output parameters does not work

Forum related to Sybase ASE

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
Ðerek wildstar
Junior Boarder
Junior Boarder
Posts: 35
Joined: 30.08.2005, 16:30
Location: Olinda / PE
Contact:

Sybase Stored Procedure w/ output parameters does not work

Post by Ðerek wildstar »

Hello!

I'm having trouble running a procedure (TZStoredProc) that contains two output parameters. The error occurs exactly in the parameters, see:


Procedure expects parameter @ p_modulo_por_menu pCodModulo, Which was not supplied.
Procedure expects parameter @ p_modulo_por_menu pNomeModulo, Which was not supplied.

My database is Sybase (unfortunately, because we use it here at work). Previously we were using BDE and we are trying to use to get rid ZeosLib definitely BDE and all its eccentricities.

Using TStoredProc (standard BDE) the procedure runs smoothly. Any ideas?
Ðerek wildstar
Junior Boarder
Junior Boarder
Posts: 35
Joined: 30.08.2005, 16:30
Location: Olinda / PE
Contact:

Post by Ðerek wildstar »

A new information: This error occurs on the second time I run TZStoredProc.ExecProc. Very strange error.

first time:

STPRModuloPorMenu.ParamByName('@pNomeMenu').AsString := 'carlos';
STPRModuloPorMenu.ExecProc;

No error!

Second time:

STPRModuloPorMenu.ParamByName('@pNomeMenu').AsString := 'carlos';
STPRModuloPorMenu.ExecProc;

Error!
Ðerek wildstar
Junior Boarder
Junior Boarder
Posts: 35
Joined: 30.08.2005, 16:30
Location: Olinda / PE
Contact:

Post by Ðerek wildstar »

More information:

The problem is that the on the second call the params are being cleared. But why this is done?

Code: Select all

procedure TZAbstractRODataset.ExecSQL;
begin
  CheckConnected;
  Connection.ShowSQLHourGlass;
  try
    if Active then Close;

    CheckSQLQuery;
    CheckInactive;

    if (Statement = nil) or (Statement.GetConnection.IsClosed) then
      Statement := CreateStatement(FSQL.Statements[0].SQL, Properties)
    else
      if (Assigned(Statement)) then 
         Statement.ClearParameters;

    SetStatementParams(Statement, FSQL.Statements[0].ParamNamesArray,
      FParams, FDataLink);

    FRowsAffected := Statement.ExecuteUpdatePrepared;
  finally
    Connection.HideSQLHourGlass;
  end;
end;
On the first call the Statement is created. On the second all parameters are cleared (Statement.ClearParameters). Why this is done? I've made a test, removing the else part and the procedure works perfectly.

The question is: This is working correctly for other databases?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Ðerek wildstar,

Seems you're using the 6.6 version. I don't know why these lines are there. I tried to remove them and they did not have any impact on when testing with firebird, sqlite and mysql. Failed to test with oracle and postgres for some strange problem on this computer at the moment.

This code has been reorganised in 7.X. Did you check if all works fine there?

Mark
Image
Post Reply