Subject | Re: Stored Procedure as a Function? |
---|---|
Author | rogervellacott |
Post date | 2003-09-30T06:31:20Z |
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:
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 forevery
> JOIN based solution. I had tried similar ones before and got thesame
> result, that's why I posted the question to the forum in the firstsomeone
> place.
> The version I'm using is 1.5 RC6, if these joins should work,
> might want to have a look...
> Thanks for you all for the help.
> Adam
>