Subject | Problem with SP |
---|---|
Author | Ryan Nilsson-Harding |
Post date | 2002-10-14T02:44:22Z |
Hi there,
I'm still getting used to SP's, so please excuse this if I'm missing
something obvious.
I have an SP which adjusts certain stock levels, depending if the
certain item is 'monitored'.
In the stock table, there is one field (called 'monitor') which
holds either 'Y' or 'N' (ie, bool).
I first check to see if the item is 'monitored', and if so, the SP
continues, otherwise, EXIT; is called.
For some reason it is ALWAYS returning 'N', even when I know
that 'monitor' has a value of 'Y' (confirmed by viewing data with
IBExpert).
Here is the SP
CREATE PROCEDURE UPD_STK_QTY (
S_ID INTEGER
)
AS
DECLARE VARIABLE isMon CHAR(1);
BEGIN
SELECT MONITOR FROM STOCK
WHERE STK_ID = :stk_id
INTO :isMon;
IF (isMon = 'N') THEN
BEGIN
EXCEPTION PART_NOT_MON;
EXIT;
END
...
END ^
The exception is ALWAYS being called, irregardless of whether the
record has 'Y' in the 'monitor' field.
I have checked the value of S_ID, prior to calling the SP, and I
have viewed this in SQLMonitor, and can clearly see that the correct
STK_ID is being queried.
I'm quite baffled by this. What am I doing wrong here?
Rgds,
-Ryan
I'm still getting used to SP's, so please excuse this if I'm missing
something obvious.
I have an SP which adjusts certain stock levels, depending if the
certain item is 'monitored'.
In the stock table, there is one field (called 'monitor') which
holds either 'Y' or 'N' (ie, bool).
I first check to see if the item is 'monitored', and if so, the SP
continues, otherwise, EXIT; is called.
For some reason it is ALWAYS returning 'N', even when I know
that 'monitor' has a value of 'Y' (confirmed by viewing data with
IBExpert).
Here is the SP
CREATE PROCEDURE UPD_STK_QTY (
S_ID INTEGER
)
AS
DECLARE VARIABLE isMon CHAR(1);
BEGIN
SELECT MONITOR FROM STOCK
WHERE STK_ID = :stk_id
INTO :isMon;
IF (isMon = 'N') THEN
BEGIN
EXCEPTION PART_NOT_MON;
EXIT;
END
...
END ^
The exception is ALWAYS being called, irregardless of whether the
record has 'Y' in the 'monitor' field.
I have checked the value of S_ID, prior to calling the SP, and I
have viewed this in SQLMonitor, and can clearly see that the correct
STK_ID is being queried.
I'm quite baffled by this. What am I doing wrong here?
Rgds,
-Ryan