Subject | Re: Stored Procedures? |
---|---|
Author | jjochoa75 |
Post date | 2003-10-21T22:17:22Z |
Try this:
CREATE PROCEDURE MY_PROC(CAT_ID INTEGER)
RETURNS (ID INTEGER, TITLE VARCHAR(100),EXP_DATETIME TIMESTAMP)
DO BEGIN
FOR SELECT id, title, ExpirationDateTime
FROM forms INNER JOIN formcategory
ON forms.id=formcategory.form_id
WHERE category_id=:CAT_ID
ORDER BY UpperTitle
INTO :ID, :TITLE, :EXP_DATETIME
DO BEGIN
SUSPEND;
END
END
CREATE PROCEDURE MY_PROC(CAT_ID INTEGER)
RETURNS (ID INTEGER, TITLE VARCHAR(100),EXP_DATETIME TIMESTAMP)
DO BEGIN
FOR SELECT id, title, ExpirationDateTime
FROM forms INNER JOIN formcategory
ON forms.id=formcategory.form_id
WHERE category_id=:CAT_ID
ORDER BY UpperTitle
INTO :ID, :TITLE, :EXP_DATETIME
DO BEGIN
SUSPEND;
END
END
--- In firebird-support@yahoogroups.com, dhay@l... wrote:
> Hi,
>
> Any takers on this one (both parts would be great!).
>
> A typical sql call I need to turn into a stored proc is:
>
> SELECT id, title, ExpirationDateTime FROM forms INNER JOIN
formcategory ON forms.id=formcategory.form_id WHERE category_id=1
ORDER BY UpperTitle;
>
> where the category_id will vary. How do I get a result set back?
>
> Thanks for any help,
>
> David
>
>
>
>