Subject Re: [firebird-support] Calling a stored procedure from C++
Author Helen Borrie
At 07:29 PM 2/12/2003 +0000, you wrote:
>Hello,
>
>Can anybody tell me how to call a Stored Procedure from within an
>application?
>
>According to the MSDN it should be easy:
>Prepare the statement, should look like:
>CString sQry = "{CALL stored-procedure name (parameter [,
>parameter])}";
>
>And then just call the SQLExec function of the CDatabase class.
>However, FireBird raises the Exception, stating it doesn't know the
>first token (CALL).
>
>Is there an alternative way of invoking these procedures?

CALL isn't an SQL command.

The SQL statement is either a SELECT or an EXECUTE PROCEDURE statement,
depending on what kind of procedure it is.

If it is of the kind where the body is

FOR SELECT <column-list> FROM <set-specification> DO
begin
...
SUSPEND;
end

("selectable stored procedure") then the proc is called with
SELECT <output-list> from ProcName(arg1, arg2...argn)
where the args are your input parameters (either as constants or as
replaceable parameters)

If it is an executable SP, then

EXECUTE PROCEDURE ProcName(arg1, arg2...argn)

/heLen