Subject | create a stored procedure |
---|---|
Author | Rick Roen |
Post date | 2004-10-15T23:09:39Z |
I'm trying to write a stored procedure to return a conversion from "x" into
pounds to be eventually used in converting amounts in a Select.
create procedure Get_Weight_Conversion
( Units VarChar(2))
Returns ( xFactor Float)
As
Begin
Case
When ( Units = 'ea' ) then xFactor = 1.0
When ( Units = 'lb' ) then xFactor = 1.0
When ( Units = 'oz' ) then xFactor = 0.625
When ( Units = 'kg' ) then xFactor = 2.2046
When ( Units = 'gm' ) then xFactor = 0.00022046
When ( Units = 'M' ) then xFactor = 1.0
else xFactor = 1.0;
end
But the compiler complains that "Case" is not recognized.
Can anyone help?
Rick
[Non-text portions of this message have been removed]
pounds to be eventually used in converting amounts in a Select.
create procedure Get_Weight_Conversion
( Units VarChar(2))
Returns ( xFactor Float)
As
Begin
Case
When ( Units = 'ea' ) then xFactor = 1.0
When ( Units = 'lb' ) then xFactor = 1.0
When ( Units = 'oz' ) then xFactor = 0.625
When ( Units = 'kg' ) then xFactor = 2.2046
When ( Units = 'gm' ) then xFactor = 0.00022046
When ( Units = 'M' ) then xFactor = 1.0
else xFactor = 1.0;
end
But the compiler complains that "Case" is not recognized.
Can anyone help?
Rick
[Non-text portions of this message have been removed]