Subject Re: [firebird-support] Newbie Questions
Author Aage Johansen
On Thu, 1 Apr 2004 11:00:24 +0000 (UTC), Martijn Tonies wrote:

>> I'm a fluent SQL Server user and am investigating Firebird and was
>> wondering if someone could help me with a couple of issues.
>>
>> 1) I'm trying to create a stored procedure as follows but it always
>> errors and won't compile. Any idea what is wrong?
>>
>> create procedure testproc as
>> begin
>> select * from testtable;
>> end
>
> With Firebird, you cannot just create procedures that return
> a resultset.
>
> If you want to create a SELECT-able procedure, that can be
> used like this:
>
> select * from testproc [(optional variables)]
>
> Then use something like:
>
> create procedure testproc returns (output1 integer, output2 integer)
> as begin
> for select column1, column2
> from testtable
> into :output1, :output2
> do suspend;
> end


If he isn't interested in returning the result to the client (just using
data within the SP) he should remove the "suspend", and put in an "begin
<do_work_here> end" section.
Also, one might need "SET TERM", and I usually misplace the ";" ...

--
Aage J.