Subject | Stored procedure - variables for FIRST x SKIP y?? |
---|---|
Author | dhay@lexmark.com |
Post date | 2003-10-27T16:00:44Z |
Hi,
Thanks for previous help on stored procedures - got several running nicely.
Now trying to pass in parameters for the FIRST x SKIP y part of the select
clause. Is this possible?
I tried the following, but always get an error.
Cheers,
David
CREATE PROCEDURE GETFORMLISTFORCAT(CAT_ID INTEGER, S INTEGER, N INTEGER)
RETURNS (ID INTEGER, TITLE VARCHAR(80), EXPIRATIONDATETIME TIMESTAMP)
AS
BEGIN
FOR
SELECT FIRST :N SKIP :S forms.id, forms.title, forms.ExpirationDateTime
FROM forms INNER JOIN formcategory ON forms.id=formcategory.form_id
WHERE formcategory.category_id=:CAT_ID
ORDER BY forms.UpperTitle
INTO :ID, :TITLE, :EXPIRATIONDATETIME
DO BEGIN
SUSPEND;
END
END
Thanks for previous help on stored procedures - got several running nicely.
Now trying to pass in parameters for the FIRST x SKIP y part of the select
clause. Is this possible?
I tried the following, but always get an error.
Cheers,
David
CREATE PROCEDURE GETFORMLISTFORCAT(CAT_ID INTEGER, S INTEGER, N INTEGER)
RETURNS (ID INTEGER, TITLE VARCHAR(80), EXPIRATIONDATETIME TIMESTAMP)
AS
BEGIN
FOR
SELECT FIRST :N SKIP :S forms.id, forms.title, forms.ExpirationDateTime
FROM forms INNER JOIN formcategory ON forms.id=formcategory.form_id
WHERE formcategory.category_id=:CAT_ID
ORDER BY forms.UpperTitle
INTO :ID, :TITLE, :EXPIRATIONDATETIME
DO BEGIN
SUSPEND;
END
END