Subject | Computed By Error in Stored Procedure --Help |
---|---|
Author | Muthu Annamalai |
Post date | 2004-04-19T19:30:25Z |
Help Please
I wrote a stored procedure and it was working good, after a while I
need to change three output parameters using computed by method, but
I am getting error on computed by line. I am using IB Expert to
write Stored Procedure. Below I produce my Stored Procedure. Apart
from this computed by error, my stored procedure returns four rows
when there is three rows in the table, I am not able to solve that
also
SET TERM ^ ;
CREATE PROCEDURE GETDISCOUNT(
ITEMID INTEGER)
RETURNS (
FULLDESCRIPTION VARCHAR(50),
FACEVALUE VARCHAR(50),
STARTDATE DATE,
ENDDATE DATE,
DISCOUNT VARCHAR(10))
AS
DECLARE VARIABLE ITEMSTYLEID INTEGER;
DECLARE VARIABLE DESCRIPTION VARCHAR (50);
DECLARE VARIABLE ATTRIBUTE1 VARCHAR (50);
DECLARE VARIABLE ATTRIBUTE2 VARCHAR (50);
begin
SELECT ITEMSTYLE.ID,
ITEMSTYLE.ATTRIBUTE1,ITEMSTYLE.ATTRIBUTE2,ITEM.DESCRIPTION FROM
ITEMSTYLE,ITEM
WHERE ITEMSTYLE.ITEMID = ITEM.ID AND ITEM.ID =:ITEMID
INTO :ITEMSTYLEID,:ATTRIBUTE1,:ATTRIBUTE2,:DESCRIPTION;
/*** Here is the error ****/
FULLDESCRIPTION COMPUTED BY (:DESCRIPTION || :ATTRIBUTE1
|| :ATTRIBUTE2);
FOR
SELECT STARTDATE,ENDDATE,FACEVALUE,DISCOUNT FROM ITEMDISCOUNT,
DISCOUNTVALUECODE
WHERE ITEMDISCOUNT.ITEMSTYLEID = :ITEMSTYLEID AND
ITEMDISCOUNT.DISCOUNTVALUECODEID = DISCOUNTVALUECODE.ID
INTO :STARTDATE,:ENDDATE, :FACEVALUE,:DISCOUNT
DO SUSPEND;
suspend;
end
^
SET TERM ; ^
Regards,
Muthu Annamalai
I wrote a stored procedure and it was working good, after a while I
need to change three output parameters using computed by method, but
I am getting error on computed by line. I am using IB Expert to
write Stored Procedure. Below I produce my Stored Procedure. Apart
from this computed by error, my stored procedure returns four rows
when there is three rows in the table, I am not able to solve that
also
SET TERM ^ ;
CREATE PROCEDURE GETDISCOUNT(
ITEMID INTEGER)
RETURNS (
FULLDESCRIPTION VARCHAR(50),
FACEVALUE VARCHAR(50),
STARTDATE DATE,
ENDDATE DATE,
DISCOUNT VARCHAR(10))
AS
DECLARE VARIABLE ITEMSTYLEID INTEGER;
DECLARE VARIABLE DESCRIPTION VARCHAR (50);
DECLARE VARIABLE ATTRIBUTE1 VARCHAR (50);
DECLARE VARIABLE ATTRIBUTE2 VARCHAR (50);
begin
SELECT ITEMSTYLE.ID,
ITEMSTYLE.ATTRIBUTE1,ITEMSTYLE.ATTRIBUTE2,ITEM.DESCRIPTION FROM
ITEMSTYLE,ITEM
WHERE ITEMSTYLE.ITEMID = ITEM.ID AND ITEM.ID =:ITEMID
INTO :ITEMSTYLEID,:ATTRIBUTE1,:ATTRIBUTE2,:DESCRIPTION;
/*** Here is the error ****/
FULLDESCRIPTION COMPUTED BY (:DESCRIPTION || :ATTRIBUTE1
|| :ATTRIBUTE2);
FOR
SELECT STARTDATE,ENDDATE,FACEVALUE,DISCOUNT FROM ITEMDISCOUNT,
DISCOUNTVALUECODE
WHERE ITEMDISCOUNT.ITEMSTYLEID = :ITEMSTYLEID AND
ITEMDISCOUNT.DISCOUNTVALUECODEID = DISCOUNTVALUECODE.ID
INTO :STARTDATE,:ENDDATE, :FACEVALUE,:DISCOUNT
DO SUSPEND;
suspend;
end
^
SET TERM ; ^
Regards,
Muthu Annamalai