Subject | Re: [ib-support] Execute stored procedure in select query |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-03-09T13:15:21Z |
Hello Supertokkie,
lowercase characters.
stored procedure here like it was a function. You can't do that; you
have to execute it like this:
execute procedure ConvertMultipack A.Multipack returning values :resultvar
...where resultvar is a variable (e.g. in another SP) or a field name.
I'm also puzzled by the WHERE clause as such.
First, you don't need to use UPPER() because ConvertMultipack returns
all-caps anyhow.
Second, since ConvertMultipack only tests against 'Y' you could change
the clause to a simple
WHERE A.MULTIPACK = 'Y'
or if you want do do it case-insensitively
WHERE UPPER( A.MULTIPACK ) = 'Y'
Greetings,
Paul Vinkenoog
> I want to convert a field in a select query that has the values Y orWhat do you mean by that? Interbase distinguishes between upper- and
> N to Yes and No.
>
> Unfortunately Interbase does not support case.
lowercase characters.
> That's why I have made a function:This proc returns 'NO' if multipack is 'y'. Is that intentional?
>
> 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 anYou don't specify what kind of error you get, but you're calling your
> 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?
stored procedure here like it was a function. You can't do that; you
have to execute it like this:
execute procedure ConvertMultipack A.Multipack returning values :resultvar
...where resultvar is a variable (e.g. in another SP) or a field name.
I'm also puzzled by the WHERE clause as such.
First, you don't need to use UPPER() because ConvertMultipack returns
all-caps anyhow.
Second, since ConvertMultipack only tests against 'Y' you could change
the clause to a simple
WHERE A.MULTIPACK = 'Y'
or if you want do do it case-insensitively
WHERE UPPER( A.MULTIPACK ) = 'Y'
Greetings,
Paul Vinkenoog