Subject | Stored proc refuses to divide two numbers! |
---|---|
Author | csswa |
Post date | 2002-05-28T17:00:47Z |
I have the following procedure. It takes two integers, divides them,
returns a float:
CREATE PROCEDURE SP_SAMPLES_PER_QUARTER (
PAR_DAYS INTEGER,
PAR_SAMPLE_COUNT INTEGER)
RETURNS (
RET_RESULT DOUBLE PRECISION)
AS
begin
--1-- RET_RESULT = 100 / 300;
--2-- RET_RESULT = CAST((100 / 300) AS DOUBLE PRECISION);
--3-- RET_RESULT = 0.123;
--4-- RET_RESULT = 1 + 1;
EXIT;
end
The two test lines (3 and 4) correctly return their values. Lines 1
and 2 return 0. What am I missing here? Do I need to cast
something??
Regards,
Andrew Ferguson
-- Made from real girl scouts.
returns a float:
CREATE PROCEDURE SP_SAMPLES_PER_QUARTER (
PAR_DAYS INTEGER,
PAR_SAMPLE_COUNT INTEGER)
RETURNS (
RET_RESULT DOUBLE PRECISION)
AS
begin
--1-- RET_RESULT = 100 / 300;
--2-- RET_RESULT = CAST((100 / 300) AS DOUBLE PRECISION);
--3-- RET_RESULT = 0.123;
--4-- RET_RESULT = 1 + 1;
EXIT;
end
The two test lines (3 and 4) correctly return their values. Lines 1
and 2 return 0. What am I missing here? Do I need to cast
something??
Regards,
Andrew Ferguson
-- Made from real girl scouts.