Subject Re: [ib-support] Execute stored procedure in select query
Author Helen Borrie
At 12:40 PM 9/03/2003 +0000, you wrote:
>I want to convert a field in a select query that has the values Y or
>N to Yes and No.
>
>Unfortunately Interbase does not support case.
>
>That's why I have made a function:
>
>CREATE PROCEDURE CONVERTMULTIPACK (
> MULTIPACK VARCHAR(1) CHARACTER SET NONE)
>RETURNS (
> MULTIPACKYESNO VARCHAR(3) CHARACTER SET NONE)
>AS
>begin
> IF (multipack = 'Y') then
> multipackyesno = 'YES';
> ELSE
> multipackyesno = 'NO';
>end
>
>
>But when I apply this procedure in the next select query, I get an
>error:
>
>SELECT A.*, AV.VERPAKKINGOMSCHRIJVING, AE.EENHEIDOMSCHRIJVING,
> AM.MULTIPACKNAAM, AM.MULTIPACKINHOUD, AN.ARTIKELNUMMER
>FROM ARTIKELEN A
> LEFT OUTER JOIN ARTIKELVERPAKKING AV ON A.ARTIKELVERPAKKINGID
>= AV.VERPAKKINGID
> LEFT OUTER JOIN ARTIKELEENHEID AE ON A.ARTIKELEENHEIDID =
>AE.EENHEIDID
> LEFT OUTER JOIN ARTIKELMULTIPACK AM ON A.MULTIPACKID =
>AM.MULTIPACKID
> LEFT OUTER JOIN ARTIKELNUMMERS AN ON A.ARTIKELID =
>AN.ARTIKELNUMMERID
>WHERE upper(convertmultipack(A.multipack)) LIKE '%Y%';
>
>Does anybody know how I should solve this problem?

Yes. Don't use a stored procedure.

All you need is

...
WHERE A.MULTIPACK = 'YES'' ;

heLen




>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/