Subject | Re: Simple Firebird syntax error |
---|---|
Author | emb_blaster |
Post date | 2009-10-09T18:32:20Z |
Hi,
Please take a look at creation of Selectable procedures documentation. Maybe this could help http://ibexpert.net/ibe/index.php?n=Doc.Firebird2SQLReferenceGuide
I think this will solve your question:
Creation of the procedure:
CREATE PROCEDURE FINDSP(v_SubNet varchar(15))
returns (ipaddress Char(39))
AS
BEGIN
FOR
SELECT
a.IP_ADDRESS
FROM
ADDRESSES a
WHERE
a.SUBNET = :V_SubNet
ORDER BY
a.IP_ADDRESS
INTO :ipaddress
DO SUSPEND;
END
Note that are 3 types of variables (used like parameters, returns and common variables).
Then to retrieve data: Select * from FINDSP('159.140.065.000');
But serious, don't understand WHY this type of procedure. It is better, IMHO, do a simple select like your first.
WTH,
Please take a look at creation of Selectable procedures documentation. Maybe this could help http://ibexpert.net/ibe/index.php?n=Doc.Firebird2SQLReferenceGuide
I think this will solve your question:
Creation of the procedure:
CREATE PROCEDURE FINDSP(v_SubNet varchar(15))
returns (ipaddress Char(39))
AS
BEGIN
FOR
SELECT
a.IP_ADDRESS
FROM
ADDRESSES a
WHERE
a.SUBNET = :V_SubNet
ORDER BY
a.IP_ADDRESS
INTO :ipaddress
DO SUSPEND;
END
Note that are 3 types of variables (used like parameters, returns and common variables).
Then to retrieve data: Select * from FINDSP('159.140.065.000');
But serious, don't understand WHY this type of procedure. It is better, IMHO, do a simple select like your first.
WTH,