Subject | Execute stored procedure in select query |
---|---|
Author | supertokkie |
Post date | 2003-03-09T12:40:40Z |
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?
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?