Subject | SP Dialect independant |
---|---|
Author | Nick Upson |
Post date | 2005-02-16T16:32:21Z |
I want to change this SP so as to get the same answer in dialect 1 or 3.
(I'm having trouble getting the different arithmatic rules straight)
CREATE PROCEDURE CONVTOMINS (PARAM1 INTEGER)
returns (RESULT INTEGER)
AS
declare variable h Integer;
declare variable m Integer;
begin
/* convert a time, held in an int as HHMM, into minutes since midnight */
if (param1 is null or param1 = 0) then
result = 0.00;
else
begin
h = (param1 - 50) / 100; /* the '- 50' causes an effective chop, not
round */
m = param1 - (h * 100);
result = (h * 60) + m;
end
end
--
Nick
-----We Solve your Computer Problems---
Founder & Listowner of the Prolifics User Group
Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly
(I'm having trouble getting the different arithmatic rules straight)
CREATE PROCEDURE CONVTOMINS (PARAM1 INTEGER)
returns (RESULT INTEGER)
AS
declare variable h Integer;
declare variable m Integer;
begin
/* convert a time, held in an int as HHMM, into minutes since midnight */
if (param1 is null or param1 = 0) then
result = 0.00;
else
begin
h = (param1 - 50) / 100; /* the '- 50' causes an effective chop, not
round */
m = param1 - (h * 100);
result = (h * 60) + m;
end
end
--
Nick
-----We Solve your Computer Problems---
Founder & Listowner of the Prolifics User Group
Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly