Subject | Re: [ib-support] return value |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-07-12T14:53:58Z |
>SET TERM ##;I think it should return a result. Exactly how do you expect the result to
>CREATE PROCEDURE MERGE_CONTENT (SRC INTEGER, DST INTEGER)
>RETURNS (Result SMALLINT)
>AS
> BEGIN
> UPDATE REF_MASTER SET CATEGORY_ID = :DST
> WHERE
> EXISTS(SELECT DISTINCT CONTENT_ID FROM REF_MASTER WHERE
>CATEGORY_ID = :SRC
> AND NOT EXISTS( SELECT CONTENT_ID FROM REF_MASTER WHERE
>CATEGORY_ID = :DST))
> AND CATEGORY_ID = :SRC;
> DELETE FROM M_CATEGORIES WHERE CATEGORY_ID = :SRC;
> Result = 1;
> EXIT;
> END ##
>but when i "EXECUTE PROCEDURE MERGE_CONTENT(1,1)" it not return value of
>Result , why ??
be returned? I'm leaving for the weekend now, but I am sure others will
pick it up and help you out.
By the way, this new version of your procedure doesn't need to check for
the existence of a category_id, since you have it in the where-clause a bit
further down (using exists is harmless, but redundant). Basically what this
procedure now does, is updating the ref_master if src exists and dst
doesn't, and delete from m_categories if src exists - regardless of the
value of dst. And then it should return 1.
Set