|Subject||Re: [ib-support] return value|
|Author||Svein Erling Tysvær|
>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)
> UPDATE REF_MASTER SET CATEGORY_ID = :DST
> 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;
> 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.