Subject Re: [firebird-support] Pulling my hair out..
Author Gordon Hamm
BTW, I took the code out, and made a simple query.. I stripped it down to nothing, and gives me an error of..
"No current record for fetch operation"

Im lost as to why this simple query wont work..


Select P.product,SI.Rec_ID
FROM stores S,Products P
     LEFT JOIN Stores_Inventory SI ON (S.Rec_ID =12)






On 4/12/14, 4:26 AM, Svein Erling Tysvær wrote:
 

>Look at the attached database.. there is only one stored procedure.. and very little data.. Only really one record..
>
>Start IB Expert.. run the stored Proc.. It will return Null.. (Not right)
>Run it again, and again after that, gives back the right value.. but
>always fails the first time..
>
>Any ideas? Am I doing something dumb?

The 'dumb' thing is that this list doesn't allow attachments, Gordon. So extract the text of the stored procedure (and possibly some table create and insert if required) and post it to this list (strip out parts that are irrelevant for your question, we don't want an SP of several thousand lines).

If your SP looks something like:

create MySP returns(a integer = ?) as
begin
a = (select coalesce(MyVariable, 0) from MySingularTable);
update or insert into MySingularTable(MyVariable)
values(gen_id(MyGenerator, 1));
suspend;
end

then this will of course return <null> if MySingularTable is empty (there's no row to select, so coalesce is not executed). Though I don't know whether your problem is similar to this or something completely different.

Set