Subject | Re: [firebird-support] Re: Problem with my first stored procedure |
---|---|
Author | Martijn Tonies |
Post date | 2005-04-19T07:54:42Z |
Hello Adam,
UPDATEs or executes other procedures.
ONLY use this for procedures that actually return/create a
resultset.
needs to be EXECUTEd.
EXECUTE PROCEDURE myproc (:input1, :input2, :input3)
RETURNING_VALUES (:output)
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com
> Not bad for your first SP. I am not familiar with FIB so I can't tellPlease - NEVER do this on a procedure that INSERTs or
> you if you are using that right, but here is some observations from
> the firebird code.
>
> Your stored procedure is a selectable stored procedure (because it
> returns something).
>
> Basically
>
> select Result_ID
> from P_SAVE_DATA_LIST_ITEM (1,'test',1);
UPDATEs or executes other procedures.
ONLY use this for procedures that actually return/create a
resultset.
> should return you something if you run it in iSQL or any otherNo, let's not do that. The procedure given is a procedure that
> Firebird tool. (replace the parameters with something that makes
> sense in your database).
>
> Your first problem is that it will not return anything. Firebird uses
> the keyword suspend to output a record from a stored procedure. Every
> time you call suspend, whatever is sitting in the output variables of
> the stored procedure is returned.
>
> So place
>
> suspend;
>
> between the last two "end" statements in the stored procedure.
needs to be EXECUTEd.
EXECUTE PROCEDURE myproc (:input1, :input2, :input3)
RETURNING_VALUES (:output)
> Then the above select statement should return as expected, and youWith regards,
> can check the doco on the FIB components to make sure you are using
> them properly.
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com