Question Is there a way to convert a positive value int to a negative value int within a stored procedure?
Example:
select num into :myNum
from table
where [conditions];
if (:myNum is not null)
then
:returnValue = :myNum;
endif;
the variable :myNum will always be a positive integer. I would like to return the same integer as a negative.
ie: if :myNum is 123456789
i would like the stored procedure to return the value of -123456789
Answer Hello,
First sorry for this late reply. Each time i receive a question from this site I'am far from home ...
To obtain a negative value, you must multiply it by -1 (in the SELECT for example).
Then in your DB proc you can use the keyword RETURN to return your integer. See this link for details on the RETURN syntax : http://docs.ingres.com/sqlref/Return