Subject Re: Stored Procedure as a Function?
Author rogervellacott
Try LEFT JOIN instead of just JOIN. Here is a full example. It
works, I promise.

This works. I promise.

CREATE TABLE TABLE_A (INT_VALUE INTEGER);

INSERT INTO TABLE_A (INT_VALUE) VALUES (1);
INSERT INTO TABLE_A (INT_VALUE) VALUES (2);
INSERT INTO TABLE_A (INT_VALUE) VALUES (3);
INSERT INTO TABLE_A (INT_VALUE) VALUES (4);

CREATE PROCEDURE MY_SP (TEST_INT INTEGER)
RETURNS (ODD_OR_EVEN CHAR(4))
AS
BEGIN
IF (TEST_INT/2.00 = CAST(TEST_INT/2.00 AS INTEGER)) THEN
ODD_OR_EVEN = 'Even';
ELSE
ODD_OR_EVEN = 'Odd';
SUSPEND;
END


SELECT A.*,SP.ODD_OR_EVEN from TABLE_A A
LEFT JOIN MY_SP(A.INT_VALUE) SP
ON 1 = 1;

Roger Vellacott

--- In firebird-support@yahoogroups.com, "apribek" <apribek@y...>
wrote:
> I'm getting "no current record for fetch operation" message for
every
> JOIN based solution. I had tried similar ones before and got the
same
> result, that's why I posted the question to the forum in the first
> place.
> The version I'm using is 1.5 RC6, if these joins should work,
someone
> might want to have a look...
> Thanks for you all for the help.
> Adam
>