Subject | Beginner fiddeling with Stored Procedure |
---|---|
Author | Kai Bohli |
Post date | 2002-03-07T21:06:57Z |
Hi All
I'm having trouble createing a sp with Firebird RC2, and wonder if anyone can help me spot the
problem with my code. Here's the code:
CREATE PROCEDURE GETSENDNUMBER
RETURNS
(
EANSERIE VARCHAR(8),
CURRENTNO INTEGER,
MAXNR INTEGER
)
AS
DECLARE VARIABLE NEWNUMBER INTEGER;
BEGIN
SELECT EANNR,SISTESENDNR, SERIETIL
FROM POST_EANSEND
WHERE ID = 1
INTO :EANSERIE, :CURRENTNO, :MAXNR;
NEWNUMBER = CURRENTNO + 1;
IF (NEWNUMBER > MAXNR) THEN
BEGIN
EXCEPTION EANSENDSERIE_OPPBRUKT;
SUSPEND;
END
UPDATE POST_EANSEND
SET SISTESENDNR = NEWNUMBER // This is the offending line.
WHERE ID = 1;
SUSPEND;
END
The error message I'm getting is this: "Dynamic ... error code = -206 Column unknown NEWNUMBER At
line 25, Column 21 (se my comment in the code for this line)
TIA
Best wishes
Kai Bohli
Norway
kaiboe@...
I'm having trouble createing a sp with Firebird RC2, and wonder if anyone can help me spot the
problem with my code. Here's the code:
CREATE PROCEDURE GETSENDNUMBER
RETURNS
(
EANSERIE VARCHAR(8),
CURRENTNO INTEGER,
MAXNR INTEGER
)
AS
DECLARE VARIABLE NEWNUMBER INTEGER;
BEGIN
SELECT EANNR,SISTESENDNR, SERIETIL
FROM POST_EANSEND
WHERE ID = 1
INTO :EANSERIE, :CURRENTNO, :MAXNR;
NEWNUMBER = CURRENTNO + 1;
IF (NEWNUMBER > MAXNR) THEN
BEGIN
EXCEPTION EANSENDSERIE_OPPBRUKT;
SUSPEND;
END
UPDATE POST_EANSEND
SET SISTESENDNR = NEWNUMBER // This is the offending line.
WHERE ID = 1;
SUSPEND;
END
The error message I'm getting is this: "Dynamic ... error code = -206 Column unknown NEWNUMBER At
line 25, Column 21 (se my comment in the code for this line)
TIA
Best wishes
Kai Bohli
Norway
kaiboe@...